Difference between revisions of "Powershell"

From Stadm
Jump to navigationJump to search
(Created page with "Category:Windows ==Purpose== *General powershell commands, basic syntax and a few useful links and scripts =Powershell Commands= ==General Commands== Get-ChildItem Get...")
 
Line 25: Line 25:
 
  w32tm
 
  w32tm
 
  netsh
 
  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
 +
*MS Link: https://technet.microsoft.com/en-us/library/cc753525.aspx
 +
*Flags
 +
\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
 +
\l Performs the operation on a symbolic link versus its destination.
  
 
=References=
 
=References=

Revision as of 14:53, 9 June 2015


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
\l Performs the operation on a symbolic link versus its destination.

References