If you're a PowerShell user, then you likely have a handful of commands you use on a regular basis. Among the hundreds of cmdlets, there are likely a few useful ones that you're unaware of. Join Mike in this video as he shares his top 5 PowerShell commands!
Looking for PowerShell training? Start learning today with ITProTV: https://go.itpro.tv/coursesall
00:00 Intro
01:09 #1: TestPath
05:50 #2: GetExecutionPolicy
08:22 #3: GetCredential
10:58 #4: InvokeCommand
15:20 #5: EnterPSSession
Commands used in video:
TestPath “c:\test.txt”
TestPath “c:\test2.txt”
NewItem ItemType File “c:\test.txt”
If (!(TestPath “c:\test.txt”)){ NewItem ItemType File “c:\test.txt” }
TestPath Path "HKLM:\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
TestPath $pshome\pwsh.exe NewerThan "July 24, 2019"
GetExecutionPolicy
SetExecutionPolicy ExecutionPolicy
$creds = GetCredential
InvokeCommand ComputerName svr01 Credential $creds ScriptBlock { GetExecutionPolicy}
InvokeCommand ComputerName svr01 Credential $creds FilePath “e:\scripts\demo.ps1”
EnterPSSession
ExitPSSession
#toppowershellcommands #usefulpowershellcommands #bestpowershellcmdlets