{"id":71,"date":"2012-01-14T13:14:25","date_gmt":"2012-01-14T13:14:25","guid":{"rendered":"https:\/\/pipe2text.com\/?page_id=71"},"modified":"2013-10-18T00:41:46","modified_gmt":"2013-10-18T00:41:46","slug":"powershell-basics","status":"publish","type":"page","link":"https:\/\/pipe2text.com\/?page_id=71","title":{"rendered":"Getting Started with PowerShell 2.0"},"content":{"rendered":"<p>Hi All,<\/p>\n<p>In this blog I would like to just pass along a few tips that will make your life easier when getting started\u00a0with PowerShell.<\/p>\n<p><strong>Opening PowerShell as Administrator without ever touching the mouse on Windows 7 or Server 2008 R2<\/strong><\/p>\n<ol>\n<li>Press the &#8220;Windows&#8221; key to open the start menu.<\/li>\n<li>Once the start menu is open, begin typing the word\u00a0&#8220;PowerShell&#8221; in the search box until it comes up as the selected item on the menu.<\/li>\n<li>To select PowerShell from the menu,\u00a0hold down\u00a0ctrl+shift and press &#8220;Enter&#8221;.<\/li>\n<li>When prompted by UAC select &#8220;Yes&#8221; by holding down the &#8220;alt&#8221; key and pressing &#8220;Y&#8221;.<\/li>\n<\/ol>\n<p>Now the PowerShell Command Prompt should be open and the Title Bar should read &#8220;Administrator: Windows PowerShell&#8221; to show that you in fact have opened it as administrator.<\/p>\n<p><strong>How to get a list of commands inside PowerShell<\/strong><\/p>\n<p>Now that I&#8217;m in PowerShell, what do I type?<\/p>\n<p>To get a list of commands just type &#8220;Get-Command&#8221; and press &#8220;Enter&#8221;. You will now long list of commands that can be used. <a href=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/01\/GetCommand1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-85\" title=\"GetCommand\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/01\/GetCommand1.jpg\" width=\"957\" height=\"229\" srcset=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/01\/GetCommand1.jpg 957w, https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/01\/GetCommand1-300x71.jpg 300w\" sizes=\"auto, (max-width: 957px) 100vw, 957px\" \/><\/a><\/p>\n<p>You will notice as shown in the screenshot above, you are not able to read all of the descriptions. To solve that problem you can type &#8220;Get-Command | Format-List&#8221; or &#8220;Get-Command | fl&#8221; to format the list.<\/p>\n<p>Now you will notice that you\u00a0may have received too much output or its jumping by on the screen so fast you can not read it.\u00a0\u00a0Also, once it completes you can not scroll back up far enough to see everything. To prevent\u00a0your\u00a0head from spinning due to the output of this command simply\u00a0append a &#8220;| more&#8221; to the end of it so I can control how fast the data is being output. The command would\u00a0be as follows:<\/p>\n<p>&#8220;Get-Command | fl | more&#8221;<\/p>\n<p>Ok. Now I&#8217;ve formatted the list but I don&#8217;t need to see all of this information right now. I just wanted to see the &#8220;Name&#8221; and the &#8220;Definition&#8221;\u00a0as well as\u00a0have the ability to read it all. To do this you could simply type &#8220;Get-Command | fl Name,Definition&#8221;.<\/p>\n<p><strong>Getting Help in PowerShell<\/strong><\/p>\n<p>Now that I have sifted thru all of these nifty commands and definitions\u00a0I have found one that peaks\u00a0interest but I dont know how to use. Its time for me to ask\u00a0for help.\u00a0To get help for\u00a0any cmdlet\u00a0you can simply type &#8220;Get-Help <em>cmdletname<\/em>&#8221; <em>(cmdletname<\/em>=the name of the cmdlet that peaks your interest). For example, to get help\u00a0for the &#8220;Get-Process&#8221; cmdlet you would type &#8220;Get-Help Get-Process&#8221; as shown in the screenshot below. This command will give you the general help you need to use this cmdlet. As you can see in the &#8220;Remarks&#8221; section of the screenshot below, you\u00a0have the option to\u00a0type &#8220;Get-Help Get-Process -examples&#8221;, &#8220;Get-Help Get-Process -detailed&#8221; or &#8220;Get-Help Get-Process -full&#8221; depending on what kind of help you need.<\/p>\n<p><a href=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/01\/GetHelp.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-96\" title=\"GetHelp\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/01\/GetHelp.jpg\" width=\"957\" height=\"498\" srcset=\"https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/01\/GetHelp.jpg 957w, https:\/\/pipe2text.com\/wp-content\/uploads\/2012\/01\/GetHelp-300x156.jpg 300w\" sizes=\"auto, (max-width: 957px) 100vw, 957px\" \/><\/a><\/p>\n<p>Now that you know how to get a list commands\u00a0as well as\u00a0how to get the help to use them, you can begin experimenting and\u00a0build from there. In my opinion, it is a good idea to\u00a0learn with cmdlets that retrieve information (for example\u00a0&#8220;Get-Process&#8221;)\u00a0when first getting started so you don&#8217;t accidentally change anything you didn&#8217;t intend too. As always, using a lab environment is the safest way to learn and test anything.<\/p>\n<p><script type=\"text\/javascript\"><!--\ngoogle_ad_client = \"ca-pub-8911664742416811\";\n\/* First Ad Unit *\/\ngoogle_ad_slot = \"9065468486\";\ngoogle_ad_width = 728;\ngoogle_ad_height = 90;\n\/\/-->\n<\/script><br \/>\n<script type=\"text\/javascript\"\nsrc=\"\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\n<\/script><\/p>\n<p>Related Links:<\/p>\n<p><strong><a title=\"Recording the Commands and Output of a PowerShell Session to a text file in PowerShell 2.0\" href=\"https:\/\/pipe2text.com\/?page_id=622\">Recording the Commands and Output of a PowerShell Session to a text file in PowerShell 2.0<\/a><\/strong><\/p>\n<p><strong><a title=\"Using the Show-Command cmdlet in PowerShell 3.0\" href=\"https:\/\/pipe2text.com\/?page_id=1297\">Using the Show-Command cmdlet in PowerShell 3.0<\/a><\/strong><\/p>\n<p><a title=\"Using the Server Manager Module in PowerShell to Install Roles and Features On a Windows Server\" href=\"https:\/\/pipe2text.com\/?page_id=1366\"><strong>Using the Server Manager Module in PowerShell to Install Roles and Features On a Windows Server<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi All, In this blog I would like to just pass along a few tips that will make your life easier when getting started\u00a0with PowerShell. Opening PowerShell as Administrator without ever touching the mouse on Windows 7 or Server 2008 &hellip; <a href=\"https:\/\/pipe2text.com\/?page_id=71\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"class_list":["post-71","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/71","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pipe2text.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=71"}],"version-history":[{"count":47,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/71\/revisions"}],"predecessor-version":[{"id":2119,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/71\/revisions\/2119"}],"wp:attachment":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}