Skip to main content
# List all processes using > 100 MB of PagedMemory in descending sort order    
C:\PS> Get-Process | Where {$_.PagedMemorySize -gt 100MB} | Sort -Desc

# PowerShell can also evaluate expressions
C:\PS> "Hello World!"
Hello World!

C:\PS> (98.6 - 32) * 5/9
37

# Production orientation allows experimenationexperimentation and confirmation
C:\PS> Get-ChildItem C:\Users\John *.bak -r | 
           Where {$_.LastWriteTime -gt (Get-Date).AddDays(-7)} |
           Remove-Item -WhatIf
What if: Performing operation "Remove File" on Target "C:\Users\John\foo.bak"

C:\PS> Get-Process iexp* | Stop-Process -Confirm

Confirm
Are you sure you want to perform this action?
Performing operation "Stop-Process" on Target "iexplore (7116)".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is Y):
# List all processes using > 100 MB of PagedMemory in descending sort order    
C:\PS> Get-Process | Where {$_.PagedMemorySize -gt 100MB} | Sort -Desc

# PowerShell can also evaluate expressions
C:\PS> "Hello World!"
Hello World!

C:\PS> (98.6 - 32) * 5/9
37

# Production orientation allows experimenation and confirmation
C:\PS> Get-ChildItem C:\Users\John *.bak -r | 
           Where {$_.LastWriteTime -gt (Get-Date).AddDays(-7)} |
           Remove-Item -WhatIf
What if: Performing operation "Remove File" on Target "C:\Users\John\foo.bak"

C:\PS> Get-Process iexp* | Stop-Process -Confirm

Confirm
Are you sure you want to perform this action?
Performing operation "Stop-Process" on Target "iexplore (7116)".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is Y):
# List all processes using > 100 MB of PagedMemory in descending sort order    
C:\PS> Get-Process | Where {$_.PagedMemorySize -gt 100MB} | Sort -Desc

# PowerShell can also evaluate expressions
C:\PS> "Hello World!"
Hello World!

C:\PS> (98.6 - 32) * 5/9
37

# Production orientation allows experimentation and confirmation
C:\PS> Get-ChildItem C:\Users\John *.bak -r | 
           Where {$_.LastWriteTime -gt (Get-Date).AddDays(-7)} |
           Remove-Item -WhatIf
What if: Performing operation "Remove File" on Target "C:\Users\John\foo.bak"

C:\PS> Get-Process iexp* | Stop-Process -Confirm

Confirm
Are you sure you want to perform this action?
Performing operation "Stop-Process" on Target "iexplore (7116)".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is Y):
Added up to date information regarding versioning.
Source Link

PowerShell 2.0 is integrated with Windows 7 and Windows Server 2008 R2, and is available for Windows XP SP3, Windows Server 2003 SP2 and Windows Vista SP1 and SP2. Powershell 5.0 is currently the standard on Windows 10 and Server 2012 R2.

PowerShell 2.0 is integrated with Windows 7 and Windows Server 2008 R2, and is available for Windows XP SP3, Windows Server 2003 SP2 and Windows Vista SP1 and SP2.

PowerShell 2.0 is integrated with Windows 7 and Windows Server 2008 R2, and is available for Windows XP SP3, Windows Server 2003 SP2 and Windows Vista SP1 and SP2. Powershell 5.0 is currently the standard on Windows 10 and Server 2012 R2.

add section on enabling script execution (a step commonly needed for new users)
Source Link

Enabling Scripts

Before you can run custom PowerShell scripts (.ps1 files), you need to enable the execution of unsigned scripts. Otherwise, attempting to run a script will produce an error:

.\test.ps1 : File C:\test.ps1 cannot be loaded because running
scripts is disabled on this system. For more information, see
about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\test.ps1
+ ~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

You can set the script execution policy with the Set-ExecutionPolicy cmdlet:

# Allow scripts to be run by all users. This command requires admin privileges
Set-ExecutionPolicy Unrestricted

# Allow scripts to be run by the current user. This does not require special privileges
Set-ExecutionPolicy Unrestricted -Scope CurrentUser

Resources

Resources

Enabling Scripts

Before you can run custom PowerShell scripts (.ps1 files), you need to enable the execution of unsigned scripts. Otherwise, attempting to run a script will produce an error:

.\test.ps1 : File C:\test.ps1 cannot be loaded because running
scripts is disabled on this system. For more information, see
about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\test.ps1
+ ~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

You can set the script execution policy with the Set-ExecutionPolicy cmdlet:

# Allow scripts to be run by all users. This command requires admin privileges
Set-ExecutionPolicy Unrestricted

# Allow scripts to be run by the current user. This does not require special privileges
Set-ExecutionPolicy Unrestricted -Scope CurrentUser

Resources

add that PS is integrated into Windows 7 and Windows Server 2008 R2
Source Link
Loading
Link
Loading