Powershell

From WikiWiki
Jump to navigation Jump to search
PowerShell Version Release Date Default Windows Versions Available Windows Versions
PowerShell 1.0 November 2006 Windows Server 2008 (*) Windows XP SP2

Windows XP SP3 Windows Server 2003 SP1

Windows Server 2003 SP2

Windows Server 2003 R2

Windows Vista

Windows Vista SP2


PowerShell 2.0 October 2009 Windows 7

Windows Server 2008 R2 (**)

Windows XP SP3

Windows Server 2003 SP2

Windows Vista SP1

Windows Vista SP2

Windows Server 2008 SP1

Windows Server 2008 SP2

PowerShell 3.0 September 2012 Windows 8

Windows Server 2012

Windows 7 SP1

Windows Server 2008 SP2

Windows Server 2008 R2 SP1

PowerShell 4.0 October 2013 Windows 8.1

Windows Server 2012 R2

Windows 7 SP1

Windows Server 2008 R2 SP1

Windows Server 2012

PowerShell 5.0 April 2014 (***) Windows 10 Windows 8.1

Windows Server 2012 R2


File info (c:\windows\system32\windowspowershell\v1.0\powershell.exe $psversiontable Fileversion OS Version
Compressed : False

Encrypted : False

Size :

Hidden : False

Name : c:\windows\system32\windowspowershell\v1.0\powershell.exe

Readable : True

System : False

Version : 6.1.7600.16385

Writeable : True

CLRVersion: 2.0.50727.5485

BuildVersion: 6.1.7601.17514

PSVersion : 2.0

WSManStackVersion : 2.0

PSCompatibleVersions : {1.0, 2.0}

SerializationVersion: 1.1.0.1

PSRemotingProtocolVersion : 2.1

6.1.7600.16385 2008 R2
Compressed : False

Encrypted : False

Size :

Hidden : False

Name : c:\windows\system32\windowspowershell\v1.0\powershell.exe

Readable : True

System : False

Version : 6.3.9600.17415

Writeable : True

PSVersion : 4.0

WSManStackVersion : 3.0

SerializationVersion : 1.1.0.1

CLRVersion : 4.0.30319.34209

BuildVersion : 6.3.9600.17400

PSCompatibleVersions : {1.0, 2.0, 3.0, 4.0}

PSRemotingProtocolVersion : 2.2

6.3.9600.17415 8.1
Compressed : False

Encrypted : False

Size :

Hidden : False

Name : c:\windows\system32\windowspowershell\v1.0\powershell.exe

Readable : True

System : False

Version : 6.2.9200.16384

Writeable : True

PSVersion : 3.0

WSManStackVersion : 3.0

SerializationVersion : 1.1.0.1

CLRVersion : 4.0.30319.18449

BuildVersion : 6.2.9200.17065

PSCompatibleVersions : {1.0, 2.0, 3.0}

PSRemotingProtocolVersion : 2.2

6.2.9200.16384 2012
Compressed : False

Encrypted : False

Size :

Hidden : False

Name : c:\windows\system32\windowspowershell\v1.0\powershell.exe

Readable : True

System : False

Version : 6.3.9600.16384

Writeable : True

PSVersion : 4.0

WSManStackVersion : 3.0

SerializationVersion : 1.1.0.1

CLRVersion : 4.0.30319.33440

BuildVersion : 6.3.9600.16384

PSCompatibleVersions : {1.0, 2.0, 3.0, 4.0}

PSRemotingProtocolVersion : 2.2

6.3.9600.16384 2012 R2


  • get-help
  • get-command
  • get-module
  • $PSVersionTable.psversion
  • get-history
  • get-process | get-member
  • Get-Host
  • $obj | select -first 5
  • $psversiontable
  • Get-ChildItem Env:
  • get-adgroup "domain admins" -Server domain.lcl -Properties * | select -Expand members


Known Tricks

Easy powershell in cmd command

invoke bluescreen bsod

self elevate

Start-Process PowerShell –Verb RunAs

or


check authenticity of process

Sign a Powershell script

Reboot Reason

Shutdown Computer

Get Lockout Location

as seen on http://gallery.technet.microsoft.com/scriptcenter/Get-LockedOutLocation-b2fd0cab

Get file version

Convert to csv

of voor nen hashtable


search all attributes for something like "pass"


get-recursive

recursive search domain groups on domain controller


uac-translate

convert an unreadable uac ldap value to something more usefull - for example uac-translate 514 will return ACCOUNTDISABLE and NORMAL_ACCOUNT

profile


get-password

random generate password