Running from Win 7 Ent environment with AV disabled.
Have MFA setup but have been able able to use the app password.
When I run this script:
#This script will enable non-owner mailbox access auditing on every mailbox in your tenancy
#First, let's get us a cred!
$userCredential = Get-Credential
#This gets us connected to an Exchange remote powershell service
$ExoSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $userCredential -Authentication Basic -AllowRedirection
Import-PSSession $ExoSession
#Enable global audit logging
Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox" -or RecipientTypeDetails -eq "SharedMailbox" -or RecipientTypeDetails -eq "RoomMailbox" -or RecipientTypeDetails -eq "DiscoveryMailbox"} | Set-Mailbox -AuditEnabled $true -AuditLogAgeLimit 180 -AuditAdmin Update, MoveToDeletedItems, SoftDelete, HardDelete, SendAs, SendOnBehalf, Create, UpdateFolderPermission -AuditDelegate Update, SoftDelete, HardDelete, SendAs, Create, UpdateFolderPermissions, MoveToDeletedItems, SendOnBehalf -AuditOwner UpdateFolderPermission, MailboxLogin, Create, SoftDelete, HardDelete, Update, MoveToDeletedItems
#Double-Check It!
Get-Mailbox -ResultSize Unlimited | Select Name, AuditEnabled, AuditLogAgeLimit | Out-Gridview
I get the following output (see Error Text) in the command line environment and I also get a GUI window that pops up with a table of mailbox names and whether they are enabled or not.
That table shows every mailbox listed as having auditing enabled but I do not think that is the case. Executed the script Friday. Over the weekend, the Microsoft Security Score dashboard still has us with only 87 out of 150 mailboxes with auditing turned on.
Any ideas what is going wrong?
Error Text
Import-PSSession : No command proxies have been created, because all of the requested remote commands would shadow existing local commands. Use the AllowClobber parameter if you
want to shadow existing local commands.
At H:\~ Thom's Scripts\AuditMailboxEnabled.ps1:7 char:1
+ Import-PSSession $ExoSession
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Import-PSSession], ArgumentException
+ FullyQualifiedErrorId : ErrorNoCommandsImportedBecauseOfSkipping,Microsoft.PowerShell.Commands.ImportPSSessionCommand
Running from Win 7 Ent environment with AV disabled.
Have MFA setup but have been able able to use the app password.
When I run this script:
I get the following output (see Error Text) in the command line environment and I also get a GUI window that pops up with a table of mailbox names and whether they are enabled or not.
That table shows every mailbox listed as having auditing enabled but I do not think that is the case. Executed the script Friday. Over the weekend, the Microsoft Security Score dashboard still has us with only 87 out of 150 mailboxes with auditing turned on.
Any ideas what is going wrong?
Error Text
Full Output