Welcome to the ConnectWise Control Remote Powershell Commands. They are my go to remote commands. Some commands will need extra configuration or tweaking depending on your environment. The others are cut and paste. Enjoy!

PowerShell & Command Prompt Commands

The commands are either PowerShell (#!ps) or Command Prompt (#!cmd) commands. There are a couple attributes that affect how the commands respond.

#MaxLength - The max length of output characters. Some may need to be larger due to amount of output data.
#TimeOut - The period of time the command can run and will be terminated after the max has been hit. Most commands are quick to respond.

SUCCESS or FAILURE
The Command Prompt commands should work fine however the PowerShell commands may fail due to the set level of running commands remote.
"ps cannot be loaded because the execution of scripts is disabled or restricted on this system."
Let's set the execution policy.

Check Execution Policy

#!ps
#maxlength=50000
#timeout=9000000
Get-ExecutionPolicy
 

Set Execution Policy to Unrestricted

#!ps
#maxlength=50000
#timeout=9000000
Set-ExecutionPolicy Unrestricted
 

Show System Information

syteminfo
 

Show Computer Information

#!ps
#maxlength=50000
#timeout=9000000
Get-ComputerInfo
 

List Performance Data

#!ps
#maxlength=50000
#timeout=9000000
Get-Counter
 

List Event Log Data

Application Log
#!ps
#maxlength=500000
#timeout=900000
Get-EventLog -Log "Application"

 
System Log
#!ps
#maxlength=500000
#timeout=900000
Get-EventLog -Log "System"

 
Attributes
-Newest X (number of events.)
#!ps
#maxlength=500000
#timeout=900000
Get-EventLog -Log "Application" -Newest 100

 
Find unique ID
#!ps
#maxlength=500000
#timeout=900000
Get-EventLog -LogName Application -InstanceId <id #>
 

Run SFC Scan

#!ps
#maxlength=50000
#timeout=9000000
sfc /scannow
 

Better SFC Scan

#!ps
#maxlength=50000
#timeout=9000000
$SFCOpt="/scannow"; Start-Process -FilePath "${env:Windir}\System32\SFC.EXE" -ArgumentList $SFCOpt -Verb RunAs;

Run DISM

#!ps
#maxlength=50000
#timeout=9000000
dism /online /cleanup-image /restorehealth
 

Run Better DISM

#!ps
#maxlength=50000
#timeout=9000000
$DismOpt="/Online /cleanup-image /Restorehealth";
Start-Process -FilePath "${env:Windir}\System32\DISM.EXE" -ArgumentList $DismOpt -Verb RunAs;
 

Run Ultimate DISM

#!ps
#maxlength=50000
#timeout=9000000
Repair-WindowsImage -Online -RestoreHealth

Find Last OS Reboot Time

#!ps
#maxlength=50000
#timeout=9000000
wmic path Win32_OperatingSystem get LastBootUpTime
 

Old School ChkDsk

#!cmd
#maxlength=50000
#timeout=9000000
chkdsk
 

Empty Recycle Bin

#!ps
#maxlength=50000
#timeout=9000000
Get-ChildItem -Path 'C:\$Recycle.Bin' -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue

Old School Defrag

#!cmd
#maxlength=50000
#timeout=9000000
defrag <drive>:
 

New School Defrag

#!cmd
#maxlength=50000
#timeout=9000000
Optimize-Volume -DriveLetter C -Defrag -Verbose
 


List HotFix Updates

#!ps
#maxlength=50000
#timeout=9000000
wmic qfe list
 

Restart Services

#!ps
#maxlength=50000
#timeout=9000000
Get-Service
 
Restart-Service -Name <Service> -Force

Remove Software

#!ps
#maxlength=50000
#timeout=9000000
wmic product get name
 
Remove the product
#!ps
#maxlength=500000
#timeout=900000
get-package '*<software>*' | uninstall-package
 

Kill Process

#!ps
#maxlength=50000
#timeout=9000000
get-process
 
Kill the process.
#!ps
#maxlength=500000
#timeout=900000
stop-process -id <id #> -force
 

IP Release and Renew

ipconfig /release && ipconfig /renew

Reboot

shutdown /r /t 30
 
/r - reboot
/t 30 - timeout period

Conclusion

There you go! These are the remote commands that help me with my day to day MSP life.