POWERSHELL CHEAT SHEET




POWERSHELL CHEAT SHEET

Windows PowerShell is Microsoft’s task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.

There are four kinds of commands Windows PowerShell can execute:

* ‘cmdlets’, which are .NET programs, written by a developer, compiled into a dynamic-link library and loaded by a PowerShell script,
* PowerShell scripts (files suffixed by ‘.ps1′),
* PowerShell functions,
* executable programs.

BASH USAGE

BASH SHELL REFERENCE GUIDE

POWERSHELL TRAINING

BASH COMMANDS THAT WORK IN POWERSHELL

BASIC POWERSHELL TERMINAL COMMANDS

Get-ChildItem -Path E:\music\Santana — list folders in Santana
Get-ChildItem -Path E:\music\Santana –Recurse — list folders in Santana then lists files for each folder
Get-ChildItem -Path E:\music\Santana -Recurse –File — lists files for each folder
Get-ChildItem -Path E:\music\Santana -Recurse -File | sort length –Descending — lists files for each folder then sort largest to smallest
List file size requires script
how to search files for strings

ICACLS C:\Folder — view permissions for the folder
ICACLS C:\important_document /remove “user” — remove user
ICACLS C:\important_document /grant “user:(r)” — grant user read access
D — delete access.
F — full access.
N — no access.
M — modify access.
RX — read and eXecute access.
R — read-only access.
W — write-only access.
ICACLS C:\Users\Music\ /remove “Everyone” — remove Everyone group from permissions
ICACLS C:\Users\Music\ /grant “Everyone:(r)” — grant Everyone group read permissions
ICACLS C:\Users\Documents\not_so_important_document /grant “Authenticated Users:(w)” — grant Authenticated Users group write permissions
ICACLS C:\Users\Documents\public_document /grant “Everyone:(r)” — grant Everyone user group the read permissions

Compress-Archive -Path 1, 2, 3 4.zip — archive files 1,2,3 in 4.zip
$ErrorActionPreference= ‘silentlycontinue’ — hide errors.

Unregister-PackageSource -Name chocolatey — unregister chocolatey
Register-PackageSource -Name chocolatey -ProviderName Chocolatey -Location http://chocolatey.org/api/v2/ — register chocolatey and install it
Install-Package -Name vlc -Source chocolatey install vlc with chocolatey
Get-Package -Name vlc — verify that vlc is installed
Choco Uninstall GIMP — use chocolatey to uninstall gimp
Get-Package — list package properties

Get-Process -Name “totally_not_malicious” — get process totally_not_malicious properties

To end a process, you can use taskkill and specify the Process ID, or PID, of the process:
taskkill /F /PID [PROCESS ID]

Get-Process -Name “*razzle*” — list processes with razzle in the name.
Get-Service — list windows system services
Get-Service wuauserv — list wuauserv service properties
Get-Service wuauserv | Format-List * — list wuauserv service properties in a formatted detailed format
Stop-Service wuauserv — stop wuauserv service
Start-Service wuauserv — start wuauserv service
Set-Service ScardSvr -StartupType Manual — set service ScardSvr To start up manually
Start-Service ScardSvr — start ScardSvr service

Install-WindowsFeature Web-WebServer,Web-Mgmt-Tools -IncludeAllSubFeature — enable web serving feature

GENERAL TUTORIALS

POWERSHELL TUTORIAL I
POWERSHELL TUTORIAL II
POWERSHELL TUTORIAL III

INSTALLATION

HOW TO INSTALL POWERSHELL IN WINDOWS XP
HOW TO INSTALL POWERSHELL IN WINDOWS 2003
HOW TO INSTALL POWERSHELL IN WINDOWS
HOW TO INSTALL POWERSHELL IN WINDOWS 7, SERVER 2008

GUIDED TUTORIALS

POWERSHELL BASICS
POWERSHELL FUNCTIONS
POWERSHELL COMMANDLETS LIST
POWERSHELL COMMANDLETS I
POWERSHELL COMMANDLETS II
POWERSHELL COMMANDLETS TUTORIALS I
POWERSHELL COMMANDLETS TUTORIALS II
HOW TO EXECUTE POWERSHELL SCRIPTS
POWERSHELL PRINTER SCRIPTS I
POWERSHELL PRINTER SCRIPTS II
POWERSHELL PRINTER SCRIPTS III
POWERSHELL PRINTER SCRIPTS IV
USEFUL POWERSHELL SCRIPTS
HOW TO TURN A POWERSHELL SCRIPT INTO AN EXECUTABLE (.EXE)

HOW TO EXECUTE POWERSHELL SCRIPT FROM BATCH FILE
POWERSHELL FOR ACTIVE DIRECTORY
POWERSHELL FOR LDAP
POWERSHELL FOR SQL
POWERSHELL FOR SHAREPOINT
POWERSHELL SCRIPT FOR NETWORK INVENTORY
POWERSHELL SCRIPT FOR CREATING SHARED FOLDERS WINDOWS 7
POWERSHELL SCRIPT TO INSTALL PRINT DRIVER

This entry was posted in Network, Notes, Print, Scan, Tools and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>