From 4f3e5c0f92ad4f5086cc27d727696e830a78a331 Mon Sep 17 00:00:00 2001 From: BossMAN559 <33293071+BossMAN559@users.noreply.github.com> Date: Tue, 4 Dec 2018 13:03:08 -0800 Subject: [PATCH 1/2] making it work on windows 10 1. upgrade to Get-MobileDeviceStatistics from Get-ActiveSyncDeviceStatistics 2. remove code to detect outdated "microsoft online service module" 3. add code to detect AzureRM module and install if not. --- .../Working/o365/GetMSOnlineUserReport.ps1 | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/PowerShell/Working/o365/GetMSOnlineUserReport.ps1 b/PowerShell/Working/o365/GetMSOnlineUserReport.ps1 index c7a0eff..88869db 100644 --- a/PowerShell/Working/o365/GetMSOnlineUserReport.ps1 +++ b/PowerShell/Working/o365/GetMSOnlineUserReport.ps1 @@ -979,7 +979,7 @@ Function GetActiveSyncDeviceStatistics [String]$PrimarySmtpAddress ) - $activeSyncDeviceStatistics = Get-ActiveSyncDeviceStatistics -Mailbox $PrimarySmtpAddress + $activeSyncDeviceStatistics = Get-MobileDeviceStatistics -Mailbox $PrimarySmtpAddress Return $activeSyncDeviceStatistics } @@ -998,7 +998,7 @@ Function GetActiveSyncDeviceStatisticsResultsProperty .PARAMETER ActiveSyncDeviceStatisticsResults Specifies an object representing the results returned by - the cmdlet named Get-ActiveSyncDeviceStatistics. + the cmdlet named Get-MobileDeviceStatistics. .PARAMETER PropertyToReturn Specifies the property name whose value should be returned. @@ -1098,15 +1098,19 @@ $Error.Clear() $ScriptStartTime = Get-Date # verify that the MSOnline module is installed and import into current powershell session -If (!([System.IO.File]::Exists(("{0}\modules\msonline\Microsoft.Online.Administration.Automation.PSModule.dll" -f $pshome)))) -{ - WriteConsoleMessage -Message ("Please download and install the Microsoft Online Services Module.") -MessageType "Error" - Exit -} +#If (!([System.IO.File]::Exists(("{0}\modules\msonline\Microsoft.Online.Administration.Automation.PSModule.dll" -f $pshome)))) +#{ +# WriteConsoleMessage -Message ("Please download and install the Microsoft Online Services Module.") -MessageType "Error" +# Exit +#} $getModuleResults = Get-Module If (!$getModuleResults) {Import-Module MSOnline -ErrorAction SilentlyContinue} Else {$getModuleResults | ForEach-Object {If (!($_.Name -eq "MSOnline")){Import-Module MSOnline -ErrorAction SilentlyContinue}}} +$getModuleResults = Get-Module +If (!$getModuleResults) {Import-Module AzureRM -ErrorAction SilentlyContinue} +Else {$getModuleResults | ForEach-Object {If (!($_.Name -eq "AzureRM")){Import-Module AzureRM -ErrorAction SilentlyContinue}}} + # verify output directory exists for results file WriteConsoleMessage -Message ("Verifying folder: {0}" -f $OutputFile) -MessageType "Verbose" If (!(TestFolderExists $OutputFile)) @@ -1280,4 +1284,4 @@ WriteConsoleMessage -Message ("Output File : {0}" -f $OutputFile) -Messa # # End of Script. # -# ----------------------------------------------------------------------------- \ No newline at end of file +# ----------------------------------------------------------------------------- From ceae75b73bc83a06466c6b0301da0e6cf9738207 Mon Sep 17 00:00:00 2001 From: BossMAN559 <33293071+BossMAN559@users.noreply.github.com> Date: Tue, 4 Dec 2018 13:40:46 -0800 Subject: [PATCH 2/2] remove commented code remove commented code --- PowerShell/Working/o365/GetMSOnlineUserReport.ps1 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/PowerShell/Working/o365/GetMSOnlineUserReport.ps1 b/PowerShell/Working/o365/GetMSOnlineUserReport.ps1 index 88869db..25c4ebb 100644 --- a/PowerShell/Working/o365/GetMSOnlineUserReport.ps1 +++ b/PowerShell/Working/o365/GetMSOnlineUserReport.ps1 @@ -1098,11 +1098,7 @@ $Error.Clear() $ScriptStartTime = Get-Date # verify that the MSOnline module is installed and import into current powershell session -#If (!([System.IO.File]::Exists(("{0}\modules\msonline\Microsoft.Online.Administration.Automation.PSModule.dll" -f $pshome)))) -#{ -# WriteConsoleMessage -Message ("Please download and install the Microsoft Online Services Module.") -MessageType "Error" -# Exit -#} + $getModuleResults = Get-Module If (!$getModuleResults) {Import-Module MSOnline -ErrorAction SilentlyContinue} Else {$getModuleResults | ForEach-Object {If (!($_.Name -eq "MSOnline")){Import-Module MSOnline -ErrorAction SilentlyContinue}}}