{"id":2279,"date":"2016-10-04T00:51:39","date_gmt":"2016-10-03T15:51:39","guid":{"rendered":"http:\/\/1bed.allright.life\/?p=2279"},"modified":"2020-04-18T21:09:22","modified_gmt":"2020-04-18T12:09:22","slug":"post-2279","status":"publish","type":"post","link":"https:\/\/1bed.allright.life\/?p=2279","title":{"rendered":"PowerShell \u3067\u7c21\u6613\u7684\u306a\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30ed\u30b0\u3092\u53d6\u5f97\u3059\u308b"},"content":{"rendered":"<h2>\u7d4c\u7def<\/h2>\n<p>PowerShell \u697d\u3057\u3044\u3057\u3001\u3042\u307e\u308a\u6df1\u304f\u8003\u3048\u305a\u306b\u300c\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30e2\u30cb\u30bf\u30fc\u3092 PowerShell \u3067\u3084\u3063\u3066\u307f\u3088\u3046\u300d\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>\u6c17\u529b\u304c\u7d9a\u3051\u3070\u3001\u3053\u3053\u304b\u3089 Excel \u51fa\u529b\u3057\u3066\u30b0\u30e9\u30d5\u5316(Excel \u82e6\u624b\u3060\u3051\u3069)\u307e\u3067\u884c\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u6982\u8981\u8a2d\u8a08<\/h2>\n<ul>\n<li>CPU<\/li>\n<li>Memory<\/li>\n<li>Disk<\/li>\n<\/ul>\n<p>\u4e0a\u8a18 3 \u3064\u306e\u60c5\u5831\u3092\u5b9a\u671f\u7684\u306b\u30ed\u30b0\u306b\u843d\u3068\u3059<\/p>\n<p>\u30b3\u30b3\u3067\u306f\u307e\u305a\u306f\u30c6\u30ad\u30b9\u30c8\u306b TAB \u533a\u5207\u308a\u3067\u30ed\u30b0\u3092\u843d\u3068\u3059\u3053\u3068\u306b\u3059\u308b\u3002TAB \u533a\u5207\u308a\u306f Excel \u306b\u565b\u307e\u3059\u306e\u304c\u697d\u306a\u306e\u3067\u63a1\u7528\u3057\u305f\u3002<\/p>\n<h2>CPU \u60c5\u5831\u306e\u8a2d\u8a08\u3068\u53d6\u5f97<\/h2>\n<p>CPU \u60c5\u5831\u306e\u6761\u4ef6\u3068\u3057\u3066\u306f\u6b21\u306e\u5185\u5bb9\u3067\u691c\u8a0e<\/p>\n<ul>\n<li>CPU \u5168\u4f53\u3001\u30b3\u30a2\u3054\u3068\u7b49\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<li>\u4f7f\u7528\u7387\u306f 42.2% \u306e\u3088\u3046\u306b\u5c0f\u6570\u70b9\u4ee5\u4e0b\u3082\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<\/ul>\n<p>\u4e0a\u8a18\u306e\u4e8b\u3092\u8e0f\u307e\u3048\u3066\u30c7\u30fc\u30bf\u30ec\u30a4\u30a2\u30a6\u30c8\u306f\u6b21\u306e\u901a\u308a\u3068\u3057\u305f<\/p>\n<blockquote>\n<p>name(\u4e00\u610f\u306e\u540d\u524d) &lt;TAB&gt; persent(\u4f7f\u7528\u7387) &lt;TAB&gt; get_datetime(\u53d6\u5f97\u65e5\u6642)<\/p>\n<\/blockquote>\n<pre><code class=\"language-powershell\">$data = Get-Counter -Counter &quot;\\Processor Information(*)\\% Processor Time&quot;\n$datetime = $data.Timestamp\nforeach($item in $data.CounterSamples) {\n    Write-Output(@($item.InstanceName.ToString(), $item.CookedValue, $datetime) -join &quot;`t&quot;)\n}\n\n_total  3.80632670560463        2016\/10\/04 0:12:10\n0,_total        3.80632670560463        2016\/10\/04 0:12:10\n0,3     1.49767854653915        2016\/10\/04 0:12:10\n0,2     1.49767854653915        2016\/10\/04 0:12:10\n0,1     7.65407363738045        2016\/10\/04 0:12:10\n0,0     4.5758760919598 2016\/10\/04 0:12:10<\/code><\/pre>\n<h2>Memory \u306e\u8a2d\u8a08\u3068\u53d6\u5f97<\/h2>\n<p>Memory \u60c5\u5831\u306e\u6761\u4ef6\u3068\u3057\u3066\u306f\u6b21\u306e\u5185\u5bb9\u3067\u691c\u8a0e<\/p>\n<ul>\n<li>\u7269\u7406\u30e1\u30e2\u30ea\u3001\u4eee\u60f3\u30e1\u30e2\u30ea(swap)\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<li>\u5168\u4f53\u306e\u5bb9\u91cf\u3068\u4f7f\u7528\u3057\u3066\u3044\u308b\u5bb9\u91cf(\u53c8\u306f\u7a7a\u304d\u5bb9\u91cf)\u3092\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<\/ul>\n<p>\u4e0a\u8a18\u306e\u4e8b\u3092\u8e0f\u307e\u3048\u3066\u30c7\u30fc\u30bf\u30ec\u30a4\u30a2\u30a6\u30c8\u306f\u6b21\u306e\u901a\u308a\u3068\u3057\u305f<\/p>\n<blockquote>\n<p>name(Physical or Virtual) &lt;TAB&gt; free(\u7a7a\u304d\u5bb9\u91cf) &lt;TAB&gt; total(\u5168\u4f53\u5bb9\u91cf) &lt;TAB&gt; get_datetime(\u53d6\u5f97\u65e5\u6642)<\/p>\n<\/blockquote>\n<pre><code class=\"language-powershell\">$data = Get-WmiObject Win32_OperatingSystem\n$datetime = Get-Date\n\nWrite-Output(@(&#039;PhysicalMemory&#039;, $data.FreePhysicalMemory, $data.TotalVisibleMemorySize, $datetime) -join &quot;`t&quot;)\nWrite-Output(@(&#039;VirtualMemory&#039;, $data.FreeVirtualMemory, $data.TotalVirtualMemorySize, $datetime) -join &quot;`t&quot;)\nPhysicalMemory  9727032 16676748        2016\/10\/04 0:34:53\nVirtualMemory   9497996 19167116        2016\/10\/04 0:34:53<\/code><\/pre>\n<h2>Disk \u306e\u8a2d\u8a08\u3068\u53d6\u5f97<\/h2>\n<p>Disk \u60c5\u5831\u306e\u6761\u4ef6\u3068\u3057\u3066\u306f\u6b21\u306e\u5185\u5bb9\u3067\u691c\u8a0e<\/p>\n<ul>\n<li>\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u7269\u7406\u30c7\u30a3\u30b9\u30af\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<li>\u5168\u4f53\u306e\u5bb9\u91cf\u3068\u4f7f\u7528\u3057\u3066\u3044\u308b\u5bb9\u91cf(\u53c8\u306f\u7a7a\u304d\u5bb9\u91cf)\u3092\u53d6\u5f97\u3067\u304d\u308b<\/li>\n<\/ul>\n<p>\u4e0a\u8a18\u306e\u4e8b\u3092\u8e0f\u307e\u3048\u3066\u30c7\u30fc\u30bf\u30ec\u30a4\u30a2\u30a6\u30c8\u306f\u6b21\u306e\u901a\u308a\u3068\u3057\u305f<\/p>\n<blockquote>\n<p>name(Device ID) &lt;TAB&gt; free(\u7a7a\u304d\u5bb9\u91cf) &lt;TAB&gt; total(\u5168\u4f53\u5bb9\u91cf) &lt;TAB&gt; get_datetime(\u53d6\u5f97\u65e5\u6642)<\/p>\n<\/blockquote>\n<pre><code class=\"language-powershell\">$data = Get-WmiObject -Class win32_logicaldisk\n$datetime = Get-Date\nforeach($item in $data) {\n    Write-Output(@($item.DeviceID, $item.FreeSpace, $item.Size, $datetime) -join &quot;`t&quot;)\n}\nC:      117137235968    254993756160    2016\/10\/04 0:52:09\nD:      120767868928    259676696576    2016\/10\/04 0:52:09<\/code><\/pre>\n<h2>\u8003\u5bdf<\/h2>\n<p>\u4ed5\u69d8\u3068\u30c7\u30fc\u30bf\u306e\u8a2d\u8a08\u3001\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u307e\u3067\u3092\u30b5\u30fc\u30c3\u3068\u4f5c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u307e\u307e\u3067\u3082 Windows \u30bf\u30b9\u30af\u30b9\u30b1\u30b8\u30e5\u30fc\u30e9\u30fc\u306b\u8a2d\u5b9a\u3057\u3066\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u5410\u304d\u7d9a\u3051\u3089\u308c\u307e\u3059\u304c\u3001\u305d\u308c\u3067\u306f\u9762\u767d\u307f\u306b\u6b20\u3051\u308b\u306e\u3067\u6b21\u56de\u306f Excel \u30d5\u30a1\u30a4\u30eb\u306b\u5410\u304f\u3068\u3053\u308d\u3092\u4f5c\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d4c\u7def PowerShell \u697d\u3057\u3044\u3057\u3001\u3042\u307e\u308a\u6df1\u304f\u8003\u3048\u305a\u306b\u300c\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30e2\u30cb\u30bf\u30fc\u3092 PowerShell \u3067\u3084\u3063\u3066\u307f\u3088\u3046\u300d\u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002 \u6c17\u529b\u304c\u7d9a\u3051\u3070\u3001\u3053\u3053\u304b\u3089 Excel \u51fa\u529b\u3057\u3066\u30b0\u30e9\u30d5\u5316(Excel \u82e6\u624b\u3060\u3051\u3069)\u307e [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,61],"tags":[97,62],"class_list":["post-2279","post","type-post","status-publish","format-standard","hentry","category-program","category-windows","tag-excel","tag-powershell"],"_links":{"self":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts\/2279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2279"}],"version-history":[{"count":11,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts\/2279\/revisions"}],"predecessor-version":[{"id":3142,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=\/wp\/v2\/posts\/2279\/revisions\/3142"}],"wp:attachment":[{"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1bed.allright.life\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}