As Microsoft moves forward with Powershell (has it already been out for 10 years?), use the following “tricks” to replace CMD completely with Powershell.
- Obviously, see if there is a Powershell way of doing the same thing (I have a couple posts on this myself..)
Old way to map a drive:
net use g: \\server\share /user:domain\user /persistent:yes
New-PSDrive -Name G -Root \Server01Scripts -Credential domain\user -Persist -PSProvider FileSystem
- If you can’t find a direct equivalent, invoke the command like:
cmd /c "net user administrator /active:no"
- Use the Stop-Parsing symbol “–%” so that Powershell won’t parse symbols such as parenthesis and brackets:
icacls c:\logs\* /grant Administrator:(D,WDAC) will fail in PowerShell.
icacls --% c:\logs\* /grant Administrator:(D,WDAC) will work
- Lastly for Windows 10 users, make sure to replace CMD with Powershell by going to Settings – Taskbar – Replace CMD with Powershell. This will only give Powershell options with the Win+X menu.