Windows commands

Shutdown the system

shutdown /r /t 0

icacls

Grant james full access to the script backup_powershell.ps1

icacls backup_powershell.ps1 /grant james:F

Services commands

#Query a service
sc qc IperiusRemoteSvc

#Start a service
sc start IperiusRemoteSvc

#Stop a service
sc stop IperiusRemoteScv

Note: Within a Powershell session, use sc.exe

Execute .vbs or .wsf scripts

C:\Temp>CScript 15589.wsf

Setting the PATH variable

set PATH=%PATH%;C:\Windows\System32

cmd.exe

cmd.exe /c <command>

An alternative to whoami

In some old systems, the binary whoami might not work

echo %username%

Add domain user account

net user amandine AAAaaa111 /add /domain

Ping

-n: number of request to send

ping -n 4 10.10.10.6

where

Check the location of a specific file, in this case bash.exe, or binary recursively from the C:\ drive

where /R c:\ bash.exe    

wmic

Check for others logical disks

wmic logicaldisk get deviceid, volumename, description

# Powershell flavor
powershell -c get-psdrive -psprovider filesystem

Checking for services that are non-standard and that are starting "auto"

wmic service get name,displayname,pathname,startmode |findstr /i "auto"
|findstr /i /v "c:\windows"

Last updated