{"id":269,"date":"2017-05-01T18:32:20","date_gmt":"2017-05-01T09:32:20","guid":{"rendered":"http:\/\/shinke1987.net\/?p=269"},"modified":"2017-05-01T19:00:52","modified_gmt":"2017-05-01T10:00:52","slug":"post-269","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=269","title":{"rendered":"WindowsUpdate\u306e\u672a\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30fb\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f\u66f4\u65b0\u30d5\u30a1\u30a4\u30eb\u3092\u8868\u793a\u3002"},"content":{"rendered":"<h2>\u74b0\u5883<\/h2>\n<p>OS\uff1aWindows 7 Professional SP1<\/p>\n<p>&nbsp;<\/p>\n<h2>\u89e3\u8aac<\/h2>\n<p>$Session\u306b\u5165\u308b\u306e\u306f\u3001IUpdateSession Interface<br \/>\n<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386854(v=vs.85).aspx\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386854(v=vs.85).aspx<\/a><br \/>\n\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3002<\/p>\n<p>$Searcher\u306b\u5165\u308b\u306e\u306f\u3001IUpdateSearcher Interface<br \/>\n<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386515(v=vs.85).aspx\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386515(v=vs.85).aspx<\/a><br \/>\n\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3002<\/p>\n<p>$Results\u306b\u5165\u308b\u306e\u306f\u3001ISearchResult Interface<br \/>\n<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386077(v=vs.85).aspx\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386077(v=vs.85).aspx<\/a><br \/>\n\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3002<\/p>\n<p>$Results.Updates\u30e1\u30bd\u30c3\u30c9\u306f\u3001IUpdateCollection Interface\u3092\u8fd4\u3059\u3002<br \/>\nIUpdateCollection Interface\u306fIUpdate Interface\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3002<br \/>\nIUpdateCollection Interface\u306e\u8a73\u7d30\u306f\u6b21\u306eURL\u3002<br \/>\n<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386107(v=vs.85).aspx\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386107(v=vs.85).aspx<\/a><\/p>\n<p>$Result\u306b\u5165\u308b\u306e\u306f\u3001IUpdate Interface<br \/>\n<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386099(v=vs.85).aspx\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/windows\/desktop\/aa386099(v=vs.85).aspx<br \/>\n\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3002<\/a><\/p>\n<h2>\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n# COM\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210\u3002\r\n$Session = New-Object -ComObject Microsoft.Update.Session\r\n# \u66f4\u65b0\u30d5\u30a1\u30a4\u30eb\u3092\u63a2\u7d22\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3002\r\n$Searcher = $Session.CreateUpdateSearcher()\r\n# \u66f4\u65b0\u30d5\u30a1\u30a4\u30eb\u3092\u63a2\u7d22\u3002\uff08\u672a\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u66f4\u65b0\u30d5\u30a1\u30a4\u30eb\u3092\u63a2\u7d22\uff09\r\n# $Results = $Searcher.Search(&quot;IsInstalled = 0 And Type = 'software'&quot;)\r\n$Results = $Searcher.Search(&quot;IsInstalled = 0&quot;)\r\nWrite-Output &quot;================================&quot;\r\nWrite-Output &quot;===== \u672a\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u66f4\u65b0 =====&quot;\r\nWrite-Output &quot;================================&quot;\r\nforeach ($Result in $Results.Updates) {\r\n    Write-Output $Result.Title\r\n}\r\n# \u66f4\u65b0\u30d5\u30a1\u30a4\u30eb\u3092\u63a2\u7d22\u3002\uff08\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f\u306e\u66f4\u65b0\u30d5\u30a1\u30a4\u30eb\u3092\u63a2\u7d22\uff09\r\n$Results = $Searcher.Search(&quot;IsInstalled = 1&quot;)\r\nWrite-Output &quot;============================&quot;\r\nWrite-Output &quot;===== \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f =====&quot;\r\nWrite-Output &quot;============================&quot;\r\nforeach ($Result in $Results.Updates) {\r\n    Write-Output $Result.Title\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u74b0\u5883 OS\uff1aWindows 7 Professional SP1 &nbsp; \u89e3\u8aac $Session\u306b\u5165\u308b\u306e\u306f\u3001IUpdateSession Interface https:\/\/msdn.microsoft.com\/j [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[17,44],"class_list":["post-269","post","type-post","status-publish","format-standard","hentry","category-windowspowershell","tag-windows","tag-windowspowershell"],"_links":{"self":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=269"}],"version-history":[{"count":6,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/269\/revisions"}],"predecessor-version":[{"id":275,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/269\/revisions\/275"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}