2016-12-07 66 views
0

我的工作組中有多臺機器。每個人都有相同的管理員用戶名和密碼,我需要在所有這些 腳本,這是否是該部分的更改密碼:通過PowerShell遠程更改工作組中本地管理員的密碼

$user = [adsi]"WinNT://$computer/$username" 
$user.SetPassword($password) 
$user.SetInfo() 

我得到這個錯誤:

The following exception occurred while retrieving member "SetPassword": "The network path was not found.

我嘗試這樣:How to Run PowerShell Commands on Remote Computers ,但它並不能幫助

我打開防火牆的遠程機器關閉,然後它的工作... 問題是,我需要在防火牆規則是什麼,讓這個?我想不出我相信哪個端口/協議

+0

我想你只需要爲[Enable-PSRemoting(https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/enable -psremoting)在遠程機器上。 –

回答

0

它同時需要遠程管理文件&打印共享規則除啓用到Administrators組(遠程證書是部分或者明確地或通過域組)在目標機器上。

以下網站顯示瞭如何在域的組策略中啓用此功能。您將需要計算機管理和Powershell部分。

https://4sysops.com/archives/add-a-user-to-the-local-administrators-group-on-a-remote-computer/

... [Computer Management] Hence, if you want to manage remote computers with Computer Management, you have to enable the Group Policy setting Allow inbound remote administration exception for the Windows Firewall. You can find the policy in Computer Configuration > Administrative Templates > Network > Network Connections > Windows Firewall > Domain Profile.

Allow inbound remote administration exception

... [Powershell] For this method to work, we need another firewall setting as with the Computer Management solution. You have to enable the Group Policy Allow inbound file and printer sharing exception. The policy is also located in Computer Configuration > Administrative Templates > Network > Network Connections > Windows Firewall > Domain Profile.

Allow inbound file and printer sharing exception

+0

謝謝!在GPO上允許入站遠程管理異常行之有效 –

相關問題