Powershell to confirm onedrive geolocation

%3CLINGO-SUB%20id%3D%22lingo-sub-1396984%22%20slang%3D%22en-US%22%3EPowershell%20to%20confirm%20onedrive%20geolocation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1396984%22%20slang%3D%22en-US%22%3E%3CP%3ERunning%20geo-migrations%20and%20can%20confirm%20status%20of%20move%2C%20but%20would%20like%20to%20run%20a%20report%20against%20the%20same%20list%20of%20users%20that%20confirms%20the%20current%20geolocation%20for%20each%20user's%20OneDrive.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1402856%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20to%20confirm%20onedrive%20geolocation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1402856%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127388%22%20target%3D%22_blank%22%3E%40John%20Reece%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHello!%20You've%20posted%20your%20question%20in%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FCommunity-Discussion%2Fbd-p%2FCommunityQuestions%22%20target%3D%22_blank%22%3ECommunity%20Discussion%20space%3C%2FA%3E%2C%20which%20is%20intended%20for%20discussion%20around%20the%20Tech%20Community%20website%20itself%2C%20not%20product%20questions.%20I'm%20moving%20your%20question%20to%20the%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fwindows-powershell%2Fbd-p%2FWindowsPowerShell%22%20target%3D%22_self%22%3EPowerShell%20space%3C%2FA%3E%20-%20please%20post%20PowerShell%20questions%20here%20in%20the%20future.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1405194%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20to%20confirm%20onedrive%20geolocation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1405194%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127388%22%20target%3D%22_blank%22%3E%40John%20Reece%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don%E2%80%99t%20have%20a%20multi-geo%20tenant%20so%20I%20was%20unable%20to%20check%20the%20output%2C%20but%20I%20think%20the%20script%20below%20is%20showing%20the%20data%20where%20you%20looking%20for.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGoodluck!%3C%2FP%3E%3CP%3EGrtz%2C%20Manfred%20de%20Laat%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24cred%20%3D%20%20Get-Credential%0A%24url%20%3D%20%22https%3A%2F%2Fxxxxxxxxx-admin.sharepoint.com%2F%22%0AConnect-SPOService%20%24url%20-Credential%20%24cred%0AConnect-MsolService%20-Credential%20%24cred%0A%0A%24Users%20%3D%20Get-MsolUser%20%0A%24UsersMoveState%20%3D%20%40()%0A%24UsersOneDriveLocation%20%3D%20%40()%0A%0Aforeach(%24User%20in%20%24Users)%7B%0A%20%20%20%20%24UsersMoveState%20%2B%3D%20Get-SPOUserAndContentMoveState%20-UserPrincipalName%20%24user.UserPrincipalName%0A%20%20%20%20%24UsersOneDriveLocation%20%2B%3D%20Get-SPOUserOneDriveLocation%20-UserPrincipalName%20%24user.UserPrincipalName%0A%7D%0Awrite-host%20%24UsersMoveState%2C%24UserOneDriveLocation%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Senior Member

Running geo-migrations and can confirm status of move, but would like to run a report against the same list of users that confirms the current geolocation for each user's OneDrive.

2 Replies

@John Reece 

Hello! You've posted your question in the Community Discussion space, which is intended for discussion around the Tech Community website itself, not product questions. I'm moving your question to the PowerShell space - please post PowerShell questions here in the future. 

@John Reece 

I don’t have a multi-geo tenant so I was unable to check the output, but I think the script below is showing the data where you looking for. 

 

Goodluck!

Grtz, Manfred de Laat

 

 

$cred =  Get-Credential
$url = "https://xxxxxxxxx-admin.sharepoint.com/"
Connect-SPOService $url -Credential $cred
Connect-MsolService -Credential $cred

$Users = Get-MsolUser 
$UsersMoveState = @()
$UsersOneDriveLocation = @()

foreach($User in $Users){
    $UsersMoveState += Get-SPOUserAndContentMoveState -UserPrincipalName $user.UserPrincipalName
    $UsersOneDriveLocation += Get-SPOUserOneDriveLocation -UserPrincipalName $user.UserPrincipalName
}
write-host $UsersMoveState,$UserOneDriveLocation