作者iversonman (我还有点饿)
看板MIS
标题Re: [活动] 有办法利用powershell来出wsus的report吗
时间Thu Sep 10 09:16:07 2015
您好~
我们公司目前有用MBSA,不过只针对Server
我分享一下我写的code :
====
$computerscope = New-Object
Microsoft.UpdateServices.Administration.ComputerTargetScope
$updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope
$wsus.GetSummariesPerComputerTarget($updatescope,$computerscope)|Export-CSV
d:\temp\needpatch.csv -Encoding UTF8| Format-Table
InstalledCount,NotInstalledCount,ComputerTarget -Wrap -Auto |ForEach {
New-Object PSObject -Property -SearchBase
"ou=tp,DC=ap,DC=vishayint,DC=com"|Select-Object
InstalledCount,NotInstalledCount,ComputerTarget @{
ComputerTarget =
($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).FullDomainName
NeededCount = ($_.DownloadedCount + $_.NotInstalledCount)
DownloadedCount = $_.DownloadedCount
NotApplicableCount = $_.NotApplicableCount
NotInstalledCount = $_.NotInstalledCount
InstalledCount = $_.InstalledCount
FailedCount = $_.FailedCount
percent = (($_.NotApplicableCount - $_.InstalledCount) /
$_.NotApplicableCount * 100)
}
}
=====
针对以上的code,run出来是没错误,但是资讯有点落差
1.我只想要抓InstalledCount,NotInstalledCount,ComputerTarget这三个table,
但是我用Format-Table 他抓不出来,可参考图 :
http://i.imgur.com/ibILZeu.jpg
2.我在ComputerTarget有定义,有办法只抓PC name或domain name吗?目前只能抓出
一堆乱码的GUID,我有加-SearchBase "ou=tp,DC=ap,DC=vishayint,DC=com",他还是
无法辨识机器的DNS
3.我code如果加了-Filter {ComputerTargetID -Like "PCTP*"} 还没是办法只截取
PCname(我们公司的PC名称都是PCTP开头)
我目前只想把我要的那三个table捞出来列在excel上面方便我看目前所有PC有哪一些没
update patch , 但是还是改不出来我要的PS
出来的资讯会像这样
http://i.imgur.com/Zp6Ekiv.jpg ,有解吗? @@
※ 引述《michaellai (麦克赖)》之铭言:
: ※ 引述《iversonman (我还有点饿)》之铭言:
: : 是否有办法用powershell来做一个monitor pc update patch for AD domain
: : 我有找到一个: http://tinyurl.com/o2a3ng3 但是看不太懂
: 你找到的那篇文章写的算清楚说~
: 还有步骤跟范例, 如果这样对你来说有难度
: (I don't like PowerShell either...)
: 建议你可以看看 MBSA
: MS Baseline Security Analyzer
: https://goo.gl/EVho3A
: http://goo.gl/AwYJHk
: https://goo.gl/rTAqxl
: 可以扫描一群机器, 可以出Report,
: 上面问你这哪来的还可以说官方工具喔~
: 以上~
--
作者 MMMB4219 (FREF) 看板 Gossiping
标题 [问卦] 有没有大学四年都单身的八卦?
时间 Wed May 23 00:00:47 2012
───────────────────────────────────────
1F:嘘 srxcomtx:够了吗 呛我呛够了吗 我大学就是没女朋友 干你妈咪05/23 00:03
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.25.197.195
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MIS/M.1441847771.A.E60.html
2F:→ iversonman: powershell好像在这蛮冷门的..还有更适合的版发文吗@@ 09/11 09:07
3F:→ lu760423: 好像有专门的版 09/11 11:54
4F:→ iversonman: 我找不到专门的板讨论powershell @@ 09/11 16:22
5F:→ Dino9021: 应该不是search computerid,查一下还有什麽element,另 09/13 07:27
6F:→ Dino9021: 外有些element是阵列,读法又不太一样,最好的资料来源 09/13 07:27
7F:→ Dino9021: 是微软technet,先前用ps来做穷人的hyperV备份还原,但 09/13 07:27
8F:→ Dino9021: 是现在都忘光了,有些语法可以参考请搜寻我的发文 XD 09/13 07:27