{"id":1655,"date":"2011-10-27T22:46:57","date_gmt":"2011-10-27T20:46:57","guid":{"rendered":"http:\/\/www.extradrm.com\/?p=1655"},"modified":"2013-10-27T22:47:37","modified_gmt":"2013-10-27T20:47:37","slug":"windows-powershell-notes","status":"publish","type":"post","link":"https:\/\/www.extradrm.com\/?p=1655","title":{"rendered":"Windows Powershell Notes"},"content":{"rendered":"<p>PS C:\\&gt; Get-ExecutionPolicy<br \/>\nif restricted<\/p>\n<p>PS C:\\&gt; Set-ExecutionPolicy RemoteSigned<\/p>\n<p>From dos : powershell c:\\monscript.ps1<\/p>\n<p>$cred = Get-Credential -Credential contoso\\administrator<br \/>\nGet-WinEvent -LogName System -ComputerName NomDeMachine -Credential $cred<\/p>\n<p>Il est bien \u00e9videment possible d\u2019ex\u00e9cuter un script powershell depuis l\u2019interpr\u00e9teur Powershell en tapant la commande suivante:<br \/>\n.\\nomduscript.ps1<\/p>\n<p>$computers = &#8220;c1&#8243;,&#8221;c2&#8221;<br \/>\nWrite-Output $computers<br \/>\nWrite-Output $pingreturns[1]<\/p>\n<p>==========================================<\/p>\n<blockquote><p><strong>Get-BiosVersionUseArray.ps1<\/strong><\/p>\n<p>$computers = &#8220;hyperv&#8221;,&#8221;hyperv-box&#8221;<\/p>\n<p>Get-WmiObject -Class win32_bios -cn $computers |<\/p>\n<p>Format-table __Server, Manufacturer, Version -AutoSize<\/p><\/blockquote>\n<p>==========================================<\/p>\n<blockquote><p><strong>Get-BiosVersionQueryAD.ps1<\/strong><\/p>\n<p>Import-Module -Name ActiveDirectory<\/p>\n<p>Get-ADComputer -filter * |<\/p>\n<p>Foreach-Object {<\/p>\n<p>Get-WmiObject -Class win32_bios -cn $_.name -EA silentlyContinue |<\/p>\n<p>Select-Object __Server, Manufacturer, Version } |<\/p>\n<p>Format-Table -Property * -AutoSize<\/p>\n<p>=====================================<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>PS C:\\&gt; Get-ExecutionPolicy if restricted PS C:\\&gt; Set-ExecutionPolicy RemoteSigned From dos : powershell c:\\monscript.ps1 $cred = Get-Credential -Credential contoso\\administrator Get-WinEvent -LogName System -ComputerName NomDeMachine -Credential $cred Il est bien \u00e9videment possible d\u2019ex\u00e9cuter un script&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":2846,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[30],"tags":[255,256],"youtube_video":null,"_links":{"self":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/1655"}],"collection":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1655"}],"version-history":[{"count":0,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/1655\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/media\/2846"}],"wp:attachment":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}