PowerShell source / read-only remote queries

Test-CloudSyncADState.ps1

[string]$User = "cloudsync.test01",

Requirements

A suitable PowerShell environment, the modules/cmdlets named in the source, and authorized access to the target lab systems.

Permissions

Authorized access to the target systems and documented read/delegation rights. Review the source before execution.

Expected output

Console validation output and selected configuration metadata; see source for exact fields.

Safety

Review against your environment before execution. Reports may contain personal or tenant identifiers. Do not publish live exports. This page does not run commands.

Inspect complete script
param(
    [string]$User = "cloudsync.test01",
    [string]$Group = "GG-CloudSync-Test",
    [string]$CloudSyncOU = "OU=Cloud Sync,OU=JFAD,DC=ad,DC=jeremyfontenot,DC=online"
)

Write-Host "=== Cloud Sync AD Validation ==="

Write-Host "`n[User]"
Get-ADUser -Identity $User `
    -Properties UserPrincipalName,Enabled,Department,PasswordLastSet,PasswordNeverExpires,ObjectGUID,DistinguishedName |
    Select-Object Name,SamAccountName,UserPrincipalName,Enabled,Department,PasswordLastSet,PasswordNeverExpires,ObjectGUID,DistinguishedName

Write-Host "`n[Group]"
Get-ADGroup -Identity $Group `
    -Properties GroupScope,GroupCategory,DistinguishedName,ObjectGUID |
    Select-Object Name,SamAccountName,GroupScope,GroupCategory,ObjectGUID,DistinguishedName

Write-Host "`n[Group Members]"
Get-ADGroupMember -Identity $Group |
    Select-Object Name,SamAccountName,ObjectClass

Write-Host "`n[Cloud Sync OU Contents]"
Get-ADObject -SearchBase $CloudSyncOU -SearchScope OneLevel -Filter * |
    Select-Object Name,ObjectClass,DistinguishedName