This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NO WHATIF AVAILABLE for remove-msoluser! | |
remove-msoluser -userprincipalname $adu.userprincipalname ; | |
# run again to remove from dumpster | |
remove-msoluser -userprincipalname $adu.userprincipalname -removefromrecyclebin -force ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# populate the DistName string below with a DN pointed at the target unreplicated OU | |
$tOU=get-adobject -Identity 'OU=Workspace,DC=SUBDOMAIN,DC=ad,DC=DOMAIN,DC=com' ; | |
# store the original ADUser object parentOU (split DN and build the parent OU) | |
$origOU=($adu.distinguishedname.split(",") | select -skip 1) -join "," ; | |
# move the ADUser object to the $tOU, note -whatif needs to be removed to execute | |
Move-ADObject -Identity $adu.ObjectGUID.guid -TargetPath $tOU.DistinguishedName -whatif ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# populate the DistName string below with a DN pointed at the target unreplicated OU | |
$tOU=get-adobject -Identity 'OU=Workspace,DC=global,DC=ad,DC=toro,DC=com' ; | |
# store the original ADUser object parentOU (split DN and build the parent OU) | |
$origOU=($adu.distinguishedname.split(",") | select -skip 1) -join "," ; | |
# move the ADUser object to the $tOU, note -whatif needs to be removed to execute | |
Move-ADObject -Identity $adu.ObjectGUID.guid -TargetPath $tOU.DistinguishedName -whatif ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rcp.recipienttype ; | |
$exorcp.recipienttype ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-MsolService ; | |
$msolu = Get-MsolUser -userp $rmbx.userprincipalname ; | |
$msolu | select userprin*, *Error*, *status*, softdel*, lic*, islic* ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$exorcp = get-exorecipient $rcp.PrimarySmtpAddress ; | |
$exorcp | select recipientt* ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$exombx = get-exomailbox -id $rmbx.userprincipalname ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Confirm User has RemoteMailbox in OnPrem mail system | |
# Note: Preconnect to onprem EX remote ps & EXO | |
# To differentiate targets, I prefix _EXO_ cmdlets with [verb]-exo[noun]) | |
# on-prem cmdlets are _un-prefixed_ | |
$tAddress = "UserUPN@DOMAIN.com" ; | |
# pull local recipient type | |
$rcp = get-recipient $tAddress ; | |
$rcp | ft -a alias, primar*, recipientt* ; | |
$rmbx = get-remotemailbox -id $rcp.PrimarySmtpAddress ; | |
$rmbx | format-table -auto Name, RecipientTypeD*, userprin* ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Confirm User has RemoteMailbox in OnPrem mail system | |
# Note: Preconnect to onprem EX remote ps & EXO | |
# To differentiate targets, I prefix _EXO_ cmdlets with [verb]-exo[noun]) | |
# on-prem cmdlets are _un-prefixed_ | |
$tAddress = "UserUPN@DOMAIN.com" ; | |
# pull local recipient type | |
$rcp = get-recipient $tAddress ; | |
$rcp | ft -a alias, primar*, recipientt* ; | |
$rmbx = get-remotemailbox -id $rcp.PrimarySmtpAddress ; | |
$rmbx | format-table -auto Name, RecipientTypeD*, userprin* ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ======== V O365 EXO ETC FUNCS() V === | |
# stuff your Office 365 admin account credentials into variables for unprompted reuse | |
<# the following are Admin (UID) and non-admin (LUA) credential objects for different tenants and logons | |
I keep their definitions in another profile-level pre-loaded module. | |
$o365AdmUid = "logon@domain.com" ; # Tenant 1 primary admin logon UPN | |
$o365LabAdmUid = "logon@domainlab.com" ; # # Tenant 2 primary admin logon UPN | |
$o365COAdmUid="logon@tenant1.onmicrosoft.com" ; # Tenant 1 optional cloud-only admin acct (for backup in case of loss of federated access) | |
$o365LabCOAdmUid="logon@tenant2.onmicrosoft.com" ; Tenant 2 cloud-only admin acct | |
# flag that switches from federated/broken SID acct to cloud only $o365COAdmUid |