Difference between revisions of "Powershell"
Jump to navigation
Jump to search
Line 21: | Line 21: | ||
Set-ExecutionPolicy RemoteSigned | Set-ExecutionPolicy RemoteSigned | ||
</source> | </source> | ||
+ | |||
+ | # Enable RDP | ||
+ | ``` | ||
+ | Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0 | ||
+ | Enable-NetFirewallRule -DisplayGroup "Remote Desktop" | ||
+ | ``` | ||
+ | # Disable RDP | ||
+ | ``` | ||
+ | Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 1 | ||
+ | Disable-NetFirewallRule -DisplayGroup "Remote Desktop" | ||
+ | ``` |
Revision as of 22:59, 30 August 2020
Command One liners
While(1) {ps | sort -des cpu | select -f 15 | ft -a; sleep 1; cls}
def jtest(var):
var2 = var + 1 print(var2)
var2 = var + 1 print(var2)
Powershell security
Set-ExecutionPolicy RemoteSigned
Enable RDP
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0 Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
Disable RDP
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 1 Disable-NetFirewallRule -DisplayGroup "Remote Desktop"