Skip to content

Instantly share code, notes, and snippets.

@mattmcnabb
Created August 23, 2016 02:06
Show Gist options
  • Save mattmcnabb/d97b22b97d1fff6f4be1d655b0ecaa25 to your computer and use it in GitHub Desktop.
Save mattmcnabb/d97b22b97d1fff6f4be1d655b0ecaa25 to your computer and use it in GitHub Desktop.
Blog_Add-a-parent-path-to-your-AD-object
$OU = Get-ADComputer MattsPC |
Select-Object @{
n='ParentContainer'
e={$_.distinguishedname -replace "CN=$($_.cn),"}
}
$Splat = @{
TypeName = 'Microsoft.ActiveDirectory.Management.ADAccount'
MemberType = 'ScriptProperty'
MemberName = 'Path'
Value = {$this.DistinguishedName -replace "CN=$($this.Name),"}
}
Update-TypeData @Splat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment