Useful powershell commands

Powershell locations

Powershell isn't located in the same directory depending whether the system is a 32 or a 64 bit machine ;

C:\windows\syswow64\windowspowershell\v1.0\powershell #64bit
C:\Windows\System32\WindowsPowerShell\v1.0\powershell #32bit

Generic powershell help commands

Those are used in the context of importing modules, knowing what modules are currently loaded, and knowing what commands those modules have available

Get-Help * #List everything loaded
Get-Help process #List everything containing "process"
Get-Help Get-Item -Full #Get full helpabout a topic
Get-Help Get-Item -Examples #List examples
Import-Module <modulepath>
Get-Command -Module <modulename>

Activating WinRM (aiming to login via evil-winrm)

enable-psremoting -force #This enables winrm

## Change NetWorkConnection Category to Private
#Requires -RunasAdministrator

Get-NetConnectionProfile |
  Where{ $_.NetWorkCategory -ne 'Private'} |
  ForEach {
    $_
    $_|Set-NetConnectionProfile -NetWorkCategory Private -Confirm
  }

Last updated

Was this helpful?