ADD os.mkdir(C:Scripte) to create_service.py

This commit is contained in:
2023-10-18 11:41:04 +02:00
parent 26aab46c59
commit f2d02216a5
4 changed files with 10 additions and 8 deletions
+8 -8
View File
@@ -21,13 +21,13 @@ def request_get(function,variable):
def exchange(ip,name): def exchange(ip,name):
# exchange_commands = "Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn; Get-Mailbox | Select-Object PSComputerName, RunspaceId, PSShowComputerName, Database, UseDatabaseRetentionDefaults, RetainDeletedItemsUntilBackup, IsHierarchyReady, IsHierarchySyncEnabled,RetentionPolicy, ExchangeGuid, AdminDisplayVersion, ExchangeUserAccountControl, IsMailboxEnabled,ProhibitSendQuota, ProhibitSendReceiveQuota, RecoverableItemsQuota, RecoverableItemsWarningQuota,CalendarLoggingQuota, IsResource, IsLinked, IsShared, IsRootPublicFolderMailbox, LinkedMasterAccount, ResetPasswordOnNextLogon,ResourceType, RoomMailboxAccountEnabled, SamAccountName, ServerLegacyDN, UseDatabaseQuotaDefaults,IssueWarningQuota, RulesQuota, UserPrincipalName, RoleAssignmentPolicy, EffectivePublicFolderMailbox, SharingPolicy,ArchiveQuota, ArchiveWarningQuota, DisabledMailboxLocations, CalendarVersionStoreDisabled, AuditEnabled,AuditLogAgeLimit, WhenMailboxCreated, AccountDisabled, Alias, OrganizationalUnit, DisplayName,LegacyExchangeDN, MaxSendSize, MaxReceiveSize, EmailAddressPolicyEnabled, PrimarySmtpAddress,RecipientType, RecipientTypeDetails, WindowsEmailAddress, Identity, IsValid, ExchangeVersion,DistinguishedName, Guid, ObjectCategory, WhenChanged, WhenCreated, WhenChangedUTC, WhenCreatedUTC,OrganizationId, Id, OriginatingServer,CustomAttribute1 | Export-Csv -Path 'exuser.csv' -NoTypeInformation -Encoding UTF8" exchange_commands = "Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn; Get-Mailbox | Select-Object PSComputerName, RunspaceId, PSShowComputerName, Database, UseDatabaseRetentionDefaults, RetainDeletedItemsUntilBackup, IsHierarchyReady, IsHierarchySyncEnabled,RetentionPolicy, ExchangeGuid, AdminDisplayVersion, ExchangeUserAccountControl, IsMailboxEnabled,ProhibitSendQuota, ProhibitSendReceiveQuota, RecoverableItemsQuota, RecoverableItemsWarningQuota,CalendarLoggingQuota, IsResource, IsLinked, IsShared, IsRootPublicFolderMailbox, LinkedMasterAccount, ResetPasswordOnNextLogon,ResourceType, RoomMailboxAccountEnabled, SamAccountName, ServerLegacyDN, UseDatabaseQuotaDefaults,IssueWarningQuota, RulesQuota, UserPrincipalName, RoleAssignmentPolicy, EffectivePublicFolderMailbox, SharingPolicy,ArchiveQuota, ArchiveWarningQuota, DisabledMailboxLocations, CalendarVersionStoreDisabled, AuditEnabled,AuditLogAgeLimit, WhenMailboxCreated, AccountDisabled, Alias, OrganizationalUnit, DisplayName,LegacyExchangeDN, MaxSendSize, MaxReceiveSize, EmailAddressPolicyEnabled, PrimarySmtpAddress,RecipientType, RecipientTypeDetails, WindowsEmailAddress, Identity, IsValid, ExchangeVersion,DistinguishedName, Guid, ObjectCategory, WhenChanged, WhenCreated, WhenChangedUTC, WhenCreatedUTC,OrganizationId, Id, OriginatingServer,CustomAttribute2 | Export-Csv -Path 'exuser.csv' -NoTypeInformation -Encoding UTF8"
#
# # PowerShell als Subprozess ausführen # PowerShell als Subprozess ausführen
# process = subprocess.Popen(["powershell", "-Command", exchange_commands], stdout=subprocess.PIPE, shell=True) process = subprocess.Popen(["powershell", "-Command", exchange_commands], stdout=subprocess.PIPE, shell=True)
#
# # Warte auf den Abschluss des PowerShell-Prozesses # Warte auf den Abschluss des PowerShell-Prozesses
# process.communicate() process.communicate()
# CSV-Datei einlesen und Feldnamen auslesen # CSV-Datei einlesen und Feldnamen auslesen
with open("exuser.csv", "r", encoding='utf-8-sig') as file: with open("exuser.csv", "r", encoding='utf-8-sig') as file:
@@ -77,7 +77,7 @@ service_time = f"23:{str(random.randint(1, 59)).zfill(2)}" ## ADD Random Time
ip = get_local_ip() ip = get_local_ip()
exchange(ip,"tnp-Invest-GmbH") exchange(ip,"tnp-Invest-GmbH")
#
# while True: # while True:
# current_time = datetime.now().strftime("%H:%M") # current_time = datetime.now().strftime("%H:%M")
# try: # try:
+2
View File
@@ -0,0 +1,2 @@
"Current Time from API-Server http://api.stines.de is 2023-08-24 09:16:51.100681"
"Current Time from API-Server http://api.stines.de is 2023-08-24 09:17:22.116785"
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.