Skip to content

Instantly share code, notes, and snippets.



Last active Jun 15, 2021
What would you like to do?
Convert DsRegCmd to a Powershell object with a oneliner
# Inspiration from by d4rkeagle65
# Output to object by Diagg/
$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