Skip to content

Instantly share code, notes, and snippets.

@Diagg

Diagg/Convert-DsRegCmd.ps1

Last active Jun 15, 2021
Embed
What would you like to do?
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