{"id":291,"date":"2017-05-10T14:56:33","date_gmt":"2017-05-10T05:56:33","guid":{"rendered":"http:\/\/shinke1987.net\/?p=291"},"modified":"2017-05-26T19:46:51","modified_gmt":"2017-05-26T10:46:51","slug":"windows-powershell-tips","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=291","title":{"rendered":"Windows PowerShell Tips"},"content":{"rendered":"<h2>\u30dd\u30ea\u30b7\u30fc\u306b\u3064\u3044\u3066<\/h2>\n<p>Bypass\u306b\u3057\u3066\u304a\u3051\u3070\u3001\u5168\u90e8\u52d5\u304f\u3002<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Set-ExecutionPolicy Bypass<\/pre>\n<h2>\u30b3\u30e1\u30f3\u30c8<\/h2>\n<p>#\u3092\u4f7f\u3046\u3002<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\"># \u3053\u306e1\u884c\u3060\u3051\u30b3\u30e1\u30f3\u30c8\u306b\u306a\u308a\u307e\u3059\u3002<\/pre>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">&lt;# \u3053\u306e1\u884c\u76ee\u3068\r\n2\u884c\u76ee\u304c\u30b3\u30e1\u30f3\u30c8\u306b\u306a\u308a\u307e\u3059\u3002#&gt;<\/pre>\n<h2>\u95a2\u6570<\/h2>\n<p>function \u95a2\u6570\u540d {<br \/>\n\u51e6\u7406\u5185\u5bb9<br \/>\n}<br \/>\n\u3053\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u306b\u306f\u3001\u95a2\u6570\u540d\u3092\u66f8\u3051\u3070\u826f\u3044\u3002<\/p>\n<h2>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30e1\u30f3\u30d0\u30fc\u53d6\u5f97\u4f8b<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">$UpdateCollection = New-Object -ComObject Microsoft.Update.UpdateColl\r\nGet-Member -InputObject $UpdateCollection<\/pre>\n<h2>\u753b\u9762\u3092\u5168\u3066\u524a\u9664<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Clear-Host<\/pre>\n<h2>\u30c9\u30e9\u30a4\u30d6\u4e00\u89a7\u3092\u53d6\u5f97<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Get-PSDrive<\/pre>\n<h2>\u5b9f\u884c\u3057\u3066\u3044\u308b\u30e6\u30fc\u30b6\u540d\u3092\u8868\u793a<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Get-Content env:username<\/pre>\n<h2>\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30c9\u30e9\u30a4\u30d6\u306e\u8ffd\u52a0<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">net use Z: \\\\\u30b5\u30fc\u30d0\u540d\\\u30c7\u30a3\u30ec\u30af\u30c8\u30ea \u30d1\u30b9\u30ef\u30fc\u30c9 \/user:\u30e6\u30fc\u30b6\u540d<\/pre>\n<h2>\u30ea\u30e2\u30fc\u30c8\u3067\u30b3\u30de\u30f3\u30c9\u30ec\u30c3\u30c8\u5b9f\u884c\uff08\u81ea\u52d5\u30ed\u30b0\u30aa\u30f3\uff09<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$Pass = ConvertTo-SecureString -AsPlainText -Force &quot;\u30d1\u30b9\u30ef\u30fc\u30c9&quot;\r\n$PSC = New-Object System.Management.Automation.PSCredential(&quot;\u30e6\u30fc\u30b6\u540d&quot;, $Pass)\r\n$Temp = Invoke-Command -ComputerName \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u540d { ls d:\\ } -Credential $PSC\r\nWrite-Host $Temp\r\n<\/pre>\n<h2>\u30ea\u30e2\u30fc\u30c8\u3067\u30ed\u30fc\u30ab\u30eb\u306b\u3042\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$Pass = ConvertTo-SecureString -AsPlainText -Force &quot;\u30d1\u30b9\u30ef\u30fc\u30c9&quot;\r\n$PSC = New-Object System.Management.Automation.PSCredential(&quot;\u30e6\u30fc\u30b6\u540d&quot;, $Pass)\r\n$Temp = Invoke-Command -ComputerName \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u540d -FilePath \u30ed\u30fc\u30ab\u30eb\u306b\u3042\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u7d76\u5bfe\u30d1\u30b9 -Credential $PSC\r\nWrite-Host $Temp\r\n<\/pre>\n<h2>\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u304b\u3089\u306e\u30ed\u30b0\u30aa\u30f3\u3092\u8a31\u53ef\u3059\u308b<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Enable-PSRemoting<\/pre>\n<p>\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\u306a\u3089\u4f8b\u5916\u306b\u300cWindows\u30ea\u30e2\u30fc\u30c8\u7ba1\u7406\u300d\u3092\u8ffd\u52a0\u3059\u308c\u3070\u826f\u3044\u3002<\/p>\n<h2>\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u306b\u30ed\u30b0\u30aa\u30f3\u3059\u308b<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$Pass = ConvertTo-SecureString -AsPlainText -Force &quot;\u30d1\u30b9\u30ef\u30fc\u30c9&quot;\r\n$PSC = New-Object System.Management.Automation.PSCredential(&quot;\u30e6\u30fc\u30b6\u540d&quot;, $Pass)\r\nEnter-PSSession -ComputerName \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u540d -Credential $PSC\r\n<\/pre>\n<h2>\u30ea\u30e2\u30fc\u30c8\u30db\u30b9\u30c8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305fHotFix\u3092\u8868\u793a\u3059\u308b<\/h2>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$Pass = ConvertTo-SecureString -AsPlainText -Force &quot;\u30d1\u30b9\u30ef\u30fc\u30c9&quot;\r\n$PSC = New-Object System.Management.Automation.PSCredential(&quot;\u30e6\u30fc\u30b6\u540d&quot;, $Pass)\r\nGet-HotFix -ComputerName \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u540d -Credential $PSC\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30dd\u30ea\u30b7\u30fc\u306b\u3064\u3044\u3066 Bypass\u306b\u3057\u3066\u304a\u3051\u3070\u3001\u5168\u90e8\u52d5\u304f\u3002 Set-ExecutionPolicy Bypass \u30b3\u30e1\u30f3\u30c8 #\u3092\u4f7f\u3046\u3002 # \u3053\u306e1\u884c\u3060\u3051\u30b3\u30e1\u30f3\u30c8\u306b\u306a\u308a\u307e\u3059\u3002 &lt;# \u3053\u306e1\u884c\u76ee\u3068 2\u884c\u76ee\u304c\u30b3\u30e1\u30f3\u30c8\u306b\u306a\u308a\u307e [&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":[44],"class_list":["post-291","post","type-post","status-publish","format-standard","hentry","category-windowspowershell","tag-windowspowershell"],"_links":{"self":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/291","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=291"}],"version-history":[{"count":6,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/291\/revisions"}],"predecessor-version":[{"id":324,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/291\/revisions\/324"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}