2
我編寫了一個腳本來獲取機器的服務,並且我想將StartMode鏡像到另一臺機器。我不能想到如何實現後者:在遠程機器上設置服務。下面有一個腳本,香港專業教育學院迄今寫的:powershell:在Windows 7機器上更改服務的啓動類型
#List of Issue of services
$NamesOfIssueServices = "Browser", "Dhcp", "Dnscache", "dwmrcs", "iphlpsvc", "LanmanServer", "LanmanWorkstation", "MMCSS", "MpsSvc", "Netlogon", "Netman", "netprofm", "NlaSvc", "nsi", "p2pimsvc","PNRPsvc","PolicyAgent", "SessionEnv", "stisvc", "W32Time", "WinHttpAutoProxySvc", "WinRM"
#get all services
$W32Services = Get-WmiObject Win32_Service
#filter wanted services
$IssueServices = $W32Services | Where-Object {$NamesOfIssueServices -contains $_.name}
#display wanted services
$IssueServices | Sort-Object name | ft Name, DisplayName, State, StartMode, StartName
+1因爲在win32_service和AUTOMATIC中看到了與set-service不同的地方! – 2012-04-05 11:53:15
謝謝你的工作 – resolver101 2012-04-05 13:42:28