问题
I have the Active Directory module installed on my Windows 7 workstation using PowerShell 3 and when I use "Set-Location AD:", it is using my current domain.
Is it possible to set my base location to a different domain?
Import-Module ActiveDirectory
Set-Location AD:
Get-ChildItem
(shows current DC info)
I would like to switch to a different AD server.
回答1:
You can try this. Assuming your domain name is fabrikam.local
Import-Module ActiveDirectory
New-PSDrive -Name ADFAB -PSProvider ActiveDirectory -Server "servername.fabrikam.local" -Scope Global -root "//RootDSE/"
Set-Location ADFAB:
回答2:
Just to add a bit to ssaviers's answer...
If you are working with a mounted ntdsutil AD snapshot, just use "localhost:10389" for the server, using whatever port you used when you mounted the snapshot with dsamain.
+1 for the answer though, New-PSDrive was what I needed to be able to restore corrupted permissions on our domain controller objects using Get-ACL and Set-ACL. I thought AdminSDHolder would fix the issue on its own, seeing as Domain Controllers group is a protected group, but even after trying to kick off that process manually we weren't seeing any results.
来源:https://stackoverflow.com/questions/28508117/how-do-i-set-location-ad-to-a-different-active-directory-domain-with-powershell