Skip to content

Instantly share code, notes, and snippets.

@Diagg
Last active September 7, 2022 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Diagg/73275dff62381eb85ad96c6fc15fea81 to your computer and use it in GitHub Desktop.
Save Diagg/73275dff62381eb85ad96c6fc15fea81 to your computer and use it in GitHub Desktop.
Convert DsRegCmd to a Powershell object with a oneliner
# Inspiration from https://gist.github.com/d4rkeagle65/b9bc42a26be44a6d66c4858a4c3bc944 by d4rkeagle65
# Output to object by Diagg/OSD-Couture.com
$Dsregcmd = New-Object PSObject ; Dsregcmd /status | Where {$_ -match ' : '}|ForEach {$Item = $_.Trim() -split '\s:\s'; $Dsregcmd|Add-Member -MemberType NoteProperty -Name $($Item[0] -replace '[:\s]','') -Value $Item[1] -EA SilentlyContinue}
# to vue full objest type : $Dsregcmd
# to vue property TenantID : $Dsregcmd.TenantId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment