Created
August 23, 2016 02:06
-
-
Save mattmcnabb/d97b22b97d1fff6f4be1d655b0ecaa25 to your computer and use it in GitHub Desktop.
Blog_Add-a-parent-path-to-your-AD-object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$OU = Get-ADComputer MattsPC | | |
Select-Object @{ | |
n='ParentContainer' | |
e={$_.distinguishedname -replace "CN=$($_.cn),"} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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