diff --git a/Controller/exchange_export.py b/Controller/exchange_export.py index ff4ff6f..5d94764 100644 --- a/Controller/exchange_export.py +++ b/Controller/exchange_export.py @@ -21,13 +21,13 @@ def request_get(function,variable): 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" - # - # # PowerShell als Subprozess ausführen - # process = subprocess.Popen(["powershell", "-Command", exchange_commands], stdout=subprocess.PIPE, shell=True) - # - # # Warte auf den Abschluss des PowerShell-Prozesses - # process.communicate() + 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 + process = subprocess.Popen(["powershell", "-Command", exchange_commands], stdout=subprocess.PIPE, shell=True) + + # Warte auf den Abschluss des PowerShell-Prozesses + process.communicate() # CSV-Datei einlesen und Feldnamen auslesen 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() exchange(ip,"tnp-Invest-GmbH") - +# # while True: # current_time = datetime.now().strftime("%H:%M") # try: diff --git a/Controller/log.txt b/Controller/log.txt new file mode 100644 index 0000000..14c679e --- /dev/null +++ b/Controller/log.txt @@ -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" diff --git a/dist/REPORTS-EX.exe b/dist/REPORTS-EX.exe new file mode 100644 index 0000000..e43f751 Binary files /dev/null and b/dist/REPORTS-EX.exe differ diff --git a/dist/exchange_export.exe b/dist/exchange_export.exe new file mode 100644 index 0000000..15bc953 Binary files /dev/null and b/dist/exchange_export.exe differ