123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <nav id="navbar">
  <header>PowerShell Beginner Documentation</header>
  <a class="nav-link" href="#Introduction">Introduction</a>
  <a class="nav-link" href="#Learning_PowerShell">Learning PowerShell</a>
  <a class="nav-link" href="#Installing_PowerShell">Installing PowerShell</a>
  <a class="nav-link" href="#Getting_Started_with_PowerShell">Getting Started with PowerShell</a>
  <a class="nav-link" href="#Getting_Familiar_with_PowerShell_Commands">Getting Familiar with PowerShell Commands</a>
  <a class="nav-link" href="#Getting_Help">Getting Help</a>
  <a class="nav-link" href="#Discover_Commands_Available_on_Your_System">Discover Commands Available on Your System</a>
  <a class="nav-link" href="#References">References</a>
</nav>
<main id="main-doc">
  <section id="Introduction" class="main-section">
    <header>Introduction</header>
    <p>PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.</p>
    <p>PowerShell commands let you manage computers from the command line. PowerShell providers let you access data stores, such as the registry and certificate store, as easily as you access the file system. PowerShell includes a rich expression parser
      and a fully developed scripting language.</p>
  </section>
  <section id="Learning_PowerShell" class="main-section">
    <header>Learning PowerShell</header>
    <p>Whether you're a Developer, a DevOps or an IT Professional, this doc will help you getting started with PowerShell. In this document we'll cover the following: installing PowerShell, samples walkthrough, PowerShell editor, debugger, testing tools
      and a map book for experienced bash users to get started with PowerShell faster.</p>
    <p>The exercises in this document are intended to give you a solid foundation in how to use PowerShell. You won't be a PowerShell guru at the end of reading this material but you will be well on your way with the right set of knowledge to start using
      PowerShell.
    </p>
  </section>
  <section id="Installing_PowerShell" class="main-section">
    <header>Installing PowerShell</header>
    <p>First you need to set up your computer working environment if you have not done so. Choose the platform below and follow the instructions. At the end of this exercise, you should be able to launch the PowerShell session.</p>
    <ul>
      <li><a href="https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6" target="_blank">PowerShell on Linux</a></li>
      <li><a href="https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-macos?view=powershell-6" target="_blank">PowerShell on macOS</a></li>
      <li><a href="https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-windows?view=powershell-6" target="_blank">PowerShell on Windows</a></li>
    </ul>
    <p>For this tutorial, you do not need to install PowerShell if you are running on Windows. You can launch PowerShell console by pressing Windows key, typing PowerShell, and clicking on Windows PowerShell. However if you want to try out the latest PowerShell,
      follow the <a href="https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-windows?view=powershell-6" rel="nofollow">PowerShell on Windows</a>.</p>
    <ul>
      <li>Alternatively you can get the PowerShell by <a href="https://github.com/PowerShell/PowerShell/blob/master/README.md#building-the-repository" target="_blank">building it</a></li>
    </ul>
  </section>
  <section id="Getting_Started_with_PowerShell" class="main-section">
    <header>Getting Started with PowerShell</header>
    <p>PowerShell commands follow a Verb-Noun semantic with a set of parameters. It's easy to learn and use PowerShell. For example, <code>Get-Process</code> will display all the running processes on your system.</p>
  </section>
  <section id="Getting_Familiar_with_PowerShell_Commands" class="main-section">
    <header>Getting Familiar with PowerShell Commands</header>
    <p>In this section, you will learn how to</p>
    <ul>
      <li>create a file, delete a file and change file directory</li>
      <li>discover what version of PowerShell you are currently using</li>
      <li>exit a PowerShell session</li>
      <li>get help if you needed</li>
      <li>find syntax of PowerShell cmdlets</li>
      <li>and more</li>
    </ul>
    <p>As mentioned above, PowerShell commands are designed to have Verb-Noun structure, for instance <code>Get-Process</code>, <code>Set-Location</code>, <code>Clear-Host</code>, etc. Let’s exercise some of the basic PowerShell commands, also known as <strong>cmdlets</strong>.</p>
    <p>Let’s exercise some of the basic PowerShell commands, also known as <strong>cmdlets</strong>.</p>
    <p>Please note that we will use the PowerShell prompt sign <strong>PS /&gt;</strong> as it appears on Linux in the following examples. It is shown as <code>PS C:\&gt;</code> on Windows.</p>
    <ol>
      <li><code>Get-Process</code>: Gets the processes that are running on the local computer or a remote computer.</li>
    </ol>
    <p>By default, you will get data back similar to the following:</p>
    <code>
PS /> Get-Process

Handles   NPM(K)    PM(K)     WS(K)     CPU(s)     Id    ProcessName
-------  ------     -----     -----     ------     --    -----------
    -      -          -           1      0.012     12    bash
    -      -          -          21     20.220    449    powershell
    -      -          -          11     61.630   8620    code
    -      -          -          74    403.150   1209    firefox

…
</code>
    <p>Only interested in the instance of Firefox process that is running on your computer?</p>
    <p>Try this:</p>
    <code>
PS /> Get-Process -Name firefox

Handles   NPM(K)    PM(K)     WS(K)    CPU(s)     Id   ProcessName
-------  ------     -----     -----    ------     --   -----------
    -      -          -          74   403.150   1209   firefox
    </code>
    <p>Want to get back more than one process? Then just specify process names and separate them with commas.</p>
    <code>
PS /> Get-Process -Name firefox, powershell
Handles   NPM(K)    PM(K)     WS(K)    CPU(s)     Id   ProcessName
-------  ------     -----     -----    ------     --   -----------
    -      -          -          74   403.150   1209   firefox
    -      -          -          21    20.220    449   powershell
    </code>
    <ol start="2">
      <li><code>Clear-Host</code>: Clears the display in the host program.
    </ol>
    <code>
PS /> Get-Process
PS /> Clear-Host
      </code>
    <p>Type too much just for clearing the screen?</p>
    <p>Here is how the alias can help.</p>
    <ol start="3">
      <li><code>Get-Alias</code>: Gets the aliases for the current session.</li>
    </ol>
    <code>
PS /> Get-Alias

CommandType     Name
-----------     ----
…

Alias           cd -> Set-Location
Alias           cls -> Clear-Host
Alias           clear -> Clear-Host
Alias           copy -> Copy-Item
Alias           dir -> Get-ChildItem
Alias           gc -> Get-Content
Alias           gmo -> Get-Module
Alias           ri -> Remove-Item
Alias           type -> Get-Content
…</code>
    <p>As you can see cls or <code>clear</code> is an alias of <code>Clear-Host</code>.</p>

    <p>Now try it:</p>

    <code>PS /> Get-Process
PS /> cls</code>
    <ol start="4">
      <li><code>cd -> Set-Location</code>: Sets the current working location to a specified location.</li>
    </ol>
    <code>
    PS /> Set-Location /home
    PS /home>
    </code>
    <ol start="5">
      <li><code>dir -> Get-ChildItem</code>: Gets the items and child items in one or more specified locations.</li>
    </ol>
    <code>
<span class="comment"># Get all files under the current directory:</span> 
PS /> Get-ChildItem 
      
<span class="comment"># Get all files under the current directory as well as its subdirectories:</span> 
PS /> cd $home 
PS /home/jen> dir -Recurse 
      
<span class="comment"># List all files with "txt" file extension. </span> 
PS /> cd $home PS /home/jen> dir –Path *.txt -Recurse 
      </code>
    <ol start="6">
      <li><code>New-Item</code>: Creates a new item.</li>
    </ol>
    <code>
<span class="comment"># An empty file is created if you type the following:</span>
PS /home/jen> New-Item -Path ./test.txt


    Directory: /home/jen


Mode                LastWriteTime         Length  Name
----                -------------         ------  ----
-a----         7/7/2016   7:17 PM              0  test.txt

</code>
    <p>You can use the <code>-Value</code> parameter to add some data to your file.</p>
    <>For example, the following command adds the phrase <code>Hello world!</code> as a file content to the <code>test.txt</code>.
      <p>Because the test.txt file exists already, we use <code>-Force</code> parameter to replace the existing content.</p>
      <code>
PS /home/jen> New-Item -Path ./test.txt -Value "Hello world!" -Force

    Directory: /home/jen


Mode                LastWriteTime         Length  Name
----                -------------         ------  ----
-a----         7/7/2016   7:19 PM             24  test.txt
    </code>
      <p>There are other ways to add some data to a file.</p>
      <p>For example, you can use <code>Set-Content</code> to set the file contents:</p>
      <code>PS /home/jen>Set-Content -Path ./test.txt -Value "Hello world again!"</code>
      <p>Or simply use <code>></code> as below:</p>
      <code>
<span class="comment"># create an empty file</span>
"" > test.txt

<span class="comment"># set "Hello world!" as content of test.txt file</span>
"Hello world!!!" > test.txt
    </code>
      <p>The pound sign # above is used for comments in PowerShell.</p>
      <ol start="7">
        <li><code>type -> Get-Content</code>: Gets the content of the item at the specified location.</li>
      </ol>
      <code>
PS /home/jen> Get-Content -Path ./test.txt
PS /home/jen> type -Path ./test.txt

Hello world again!
    </code>
      <ol start="8">
        <li><code>del -> Remove-Item</code>: Deletes the specified items.</li>
      </ol>
      <p>This cmdlet will delete the file <code>/home/jen/test.txt</code>:</p>
      <code>PS /home/jen> Remove-Item ./test.txt</code>
      <ol start="9">
        <li><code>$PSVersionTable</code>: Displays the version of PowerShell you are currently using.</li>
      </ol>
      <p>Type $PSVersionTable in your PowerShell session, you will see something like below. "PSVersion" indicates the PowerShell version that you are using.</p>
      <code>
    Name                           Value
    ----                           -----
    PSVersion                      6.0.0-alpha
    PSEdition                      Core
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    BuildVersion                   3.0.0.0
    GitCommitId                    v6.0.0-alpha.12
    CLRVersion
    WSManStackVersion              3.0
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    </code>
      <ol start="10">
        <li><code>Exit</code>:To exit the PowerShell session, type exit.</li>
      </ol>
      <code>PS /home/jen> exit</code>
  </section>
  <section id="Getting_Help" class="main-section">
    <header>Getting Help</header>
    <p>The most important command in PowerShell is possibly the Get-Help, which allows you to quickly learn PowerShell without having to search around the internet.</p>

    <p>The <code>Get-Help</code> cmdlet also shows you how PowerShell commands work with examples.</p>
    <p>It shows the syntax and other technical information of the <code>Get-Process </code> cmdlet.</p>
    <code>PS /> Get-Help -Name Get-Process</code>
    <p>It displays the examples how to use the <code>Get-Process</code> cmdlet.</p>
    <code>PS />Get-Help -Name Get-Process -Examples</code>
    <p>If you use <strong>-Full</strong> parameter, for example, <code>Get-Help -Name Get-Process -Full</code>, it will display more technical information.</p>
  </section>
  <section id="Discover_Commands_Available_on_Your_System" class="main-section">
    <header>Discover Commands Available on Your System</header>
    <p>You want to discover what PowerShell cmdlets available on your system? Just run <code>Get-Command</code> as below:</p>
    <code>PS /> Get-Command</code>
    <p>If you want to know whether a particular cmdlet exists on your system, you can do something like below:</p>
    <code>PS /> Get-Command Get-Process</code>
    <p>If you want to know the syntax of <code>Get-Process</code> cmdlet, type:</p>
    <code>PS /> Get-Command Get-Process -Syntax</code>
    <p>If you want to know how to use the Get-Process, type:</p>
    <code>PS /> Get-Help Get-Process -Example</code>
  </section>
  <section id="References" class="main-section">
    <header>References</header>
    <p>Original sources of text:</p>
    <ol>
    <li>GitHub. 2018. <a href="https://github.com/PowerShell/PowerShell/blob/master/docs/learning-powershell/powershell-beginners-guide.md">PowerShell Beginner's Guide.</a>[Accessed 5 Dec. 2018].</li>
    <li>Microsoft. 2018. <a href=" https://docs.microsoft.com/en-us/powershell/scripting/powershell-scripting?view=powershell-6">PowerShell Scripting.</a> [Accessed 5 Dec. 2018].</li>
    </ol>
  </section>
</main>
            
          
!
            
              @import url("https://fonts.googleapis.com/css?family=Ubuntu");

:root {
  box-sizing: border-box;
}
body {
  display: flex;
  font-family: 'Ubuntu', sans-serif;
  margin:0 1% 0 1%;
  padding: 0;
  @media (max-width: 850px) {
    flex-direction: column;
  }
}

header {
  font-weight: bold !important;
  border-bottom: 3px dimgray solid;
  margin-top: 2em;
}

a{
  color: #0366d6;
}

#navbar {
  display: flex;
  position: fixed;
  top: 0;
  height: 100%;
  width: 25%;
  flex-direction: column;
  background: white;
  @media (max-width: 850px) {
    position: static;
    margin-bottom: 1em;
    height: auto;
    border-bottom: thick black solid;
    width: auto;
  }
}

nav > header {
  font-size: 150%;
  overflow:hidden;
  @media (max-width: 850px){
    text-align: center;
  }
}

.nav-link {
  display: block;
  color: #0366d6;
  border-bottom: 2px dimgray solid;
  margin: 1%;
  padding: 0 1em 1em 1em;
}

main {
  padding: 0 1em 0 1em;
  margin-left: 1em;
  border-left: thick dimgray solid;
  margin-left: 26%;
  @media (max-width: 850px) {
    border-left: none;
    margin: 0;
  }
}

section > header {
  font-size: 200%;
}

code {
  color: white;
  background-color: #012456;
  display: inline-block;
  padding: 0 1em 0 1em;
  white-space: pre;
  word-break: normal;
  word-wrap: normal;
  max-width: 100%;
  overflow: auto;
  border-left: thick white inset;
}

.comment {
  color: #98fb98;
}

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console