大佬教程收集整理的这篇文章主要介绍了windows – 通过PowerShell自动化WSUS,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
目前我正在做这样的事情:
#SELEct Target Group for update Approval: $TargetComputerGroups = "All Computers","Unassigned Computers","Clients","Servers","Test","View Templates" $UserPrompt = @" Please SELEct a Computer Group from the below options: 1) All Computers (SELEcts all of the below) 2) Unassigned Computers 3) Clients 4) Servers 5) Test 6) View Templates Enter SELEction "@ ###Record user SELEction to varirable $TargetComputerGroupTemp = Read-Host -Prompt $UserPrompt ###Convert their choice to the correct 0-index array value. $TargetComputerIndex = $TargetComputerGroupTemp -1 $ComputerTarget = $TargetComputerGroups[$TargetComputerIndex]
是否有’get-targets’命令可以创建一系列可用的目标组?这样我就可以删除$TargetComputerGroups的手动声明.
另外,我想让$UserPrompt成为更好的代码集(再次避免手动声明).我觉得做’$i for $i for $TargetComputerGroups’写主机’按1给我’
然后,您可以执行以下操作.
[void][reflection.assembly]::LoadWithPartialName("Microsoft.updateservices.Administration") $wsus = [Microsoft.updateservices.Administration.AdminProxy]::getupdateServer(“wsus_server”,$falsE) $wsus
然后,您可以获得目标组列表
$wsus.GetComputerTargetGroups()
或者选择一个组
$targetgroup = $wsus.GetComputerTargetGroups() | ? {$_.Name -eq "some target name"}
在Use PowerShell to Perform Basic Administrative Tasks on WSUS中有更多信息,但上述信息将为您提供有关组的信息.
以上是大佬教程为你收集整理的windows – 通过PowerShell自动化WSUS全部内容,希望文章能够帮你解决windows – 通过PowerShell自动化WSUS所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。