How do I set-location ad: to a different active directory domain with Powershell

不问归期 提交于 2019-12-25 04:09:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!