Powershell

From Stadm
Jump to navigationJump to search


Purpose

  • General powershell commands, basic syntax and a few useful links and scripts

Powershell Commands

General Commands

Get-ChildItem
Get-wmiObject
Enter-PSSession
New-PSSession

Group Policy

Powershell Scripts

Legacy(CMD)

  • Still some useful commands we need to know(they can be run in powershell)
gpupdate
gpresult 
w32tm
netsh
icacls

ACLs

  • We can take ownership, add and remove permissions all with the icacls command
  • Take ownership
icacls FILE_NAME /setowner USERNAME /t /c /q
  • grant full permission to one user
icacls FILE_NAME /grant eddie:f /t /q
\t Performs the operation on all specified files in the current directory and its subdirectories.
\c Continues the operation despite any file errors. Error messages will still be displayed.
\q Suppresses success messages.
\l Performs the operation on a symbolic link versus its destination.

References