Office 365 Powershell Help


guys,

i have interesting powershell question. 

forgive me, i'm not powershell expert...but want delete users in cloud a) not licensed , b) not administrators...  short , sweet, have lab we're using test o365 features, etc. , 1 of tests directory sync specific ou's, however, accidentally sync'd entire ad domain.  don't want remove admins, , have sharepoint licensed users want keep, however, blow away else in lab.  i've stopped directory synchronization, need powershell delete objects in cloud.

i've figured out how query non-licensed users....

get-msoluser -all | {$_.islicensed -eq "false"}

and how of global admins:

$role = get-msolrole -rolename "company administrator"

get-msolrolemember -roleobjectid &role.objectid

but i'm having heck of time figuring out powershell false licensed users , non-administrators , pipe remove-msoluser command.

i figure like:  

get-msoluser -all | {$_.islicensed -eq "false"} | ????? non-admins | remove-msoluser

either above, or if get-msoluser have attribute marking if it's admin or not (not seeing one) make easier.

any can think of :bowdown:

thanks in advance!!!

it configuration issue: http://community.office365.com/en-us/forums/148/t/8362.aspx

i'm guessing you're running powershell administrator well.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS