從Windows伺服器在Windows客戶端上執行命令

從Windows伺服器在Windows客戶端上執行命令

我們如何從 Windows 伺服器或網路上的管理網域在 CMD 或 Power shell Windows 用戶端上執行命令

我們使用 Windows Server 2016 作為 Active Directory,所有使用者都擁有 Windows 10

我們想在客戶端上發送“gpresult /r”和“gpupdate”命令

答案1

若要遠端執行命令,您可以使用 Windows 遠端 Shell (WinRs) 或 PowerShell 遠端處理。然而,gpresult 在這些情況下通常無法正確執行,因此不應被視為可靠。 Gpupdate 可以運行,但應與/target:computerswitch 一起使用。 WinRs/PSRemoting 都需要連接埠 tcp/5985 或 tcp/5986(用於 TLS)進行網路通信,使用相同的底層技術,並且是本機工具而不是外部二進位檔案。

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/winrs

https://learn.microsoft.com/en-us/powershell/scripting/learn/ps101/08-powershell-remoting?view=powershell-7.3

相關內容