Skip to content

Instantly share code, notes, and snippets.

@kdemanuele
Created December 30, 2016 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kdemanuele/6c453d601cce0d84575898737919f4e8 to your computer and use it in GitHub Desktop.
Save kdemanuele/6c453d601cce0d84575898737919f4e8 to your computer and use it in GitHub Desktop.
Easily Disabling PowerShell Remoting
# Remove all trusted hosts
Set-Item WSMan:\localhost\Client\TrustedHosts -Value '*'
# Disable PSRemoting
Disable-PSRemoting -Force
# Disabling PSRemoting is not enough to reverse the changes that were done when PSRemoting was enabled.
# The PSSession Configurations created when the command Set-WSManQuickConfig was executed needs to be reverted
Unregister-PSSessionConfiguration -Name *
# Ensure that all PSRemoting configuration were removed
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment