CmdID / PowerShell / Cmdlets / Disable
Disable-PSRemoting
Prevents PowerShell endpoints from receiving remote connections. PowerShell reference
From the PowerShell reference 3 parameters
What it does
Prevents PowerShell endpoints from receiving remote connections. The Disable-PSRemoting cmdlet blocks remote access to all Windows PowerShell session endpoint configurations on the local computer. This includes any endpoints created by PowerShell 6 or higher. To re-enable remote access to all session configurations, use the Enable-PSRemoting cmdlet. This includes any endpoints created by PowerShell 6 or higher. To enable remote access to selected session configurations, use the AccessMode parameter of the Set-PSSessionConfiguration cmdlet. You can also use the Enable-PSSessionConfiguration and Disable-PSSessionConfiguration cmdlets to enable and disable session configurations for all users. For more information about session configurations, see about_Session_Configurations. NOTE: Even after running Disable-PSRemoting you can still make loopback connections on the local machine. A loopback connection is a PowerShell remote session that originates from and connects to the same local machine. Remote sessions from external sources remain blocked. For loopback connections you must use implicit credentials along the EnableNetworkAccess parameter. For more information about loopback connections, see New-PSSession. To run this cmdlet, start Windows PowerShell with the Run as administrator option.
Disable-PSRemoting [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Prevent remote access to all session configurations
Disable-PSRemotingIdentifyPrevent remote access to all session configurations without confirmation prompt
Disable-PSRemoting -ForceIdentifyEffects of running this cmdlet
Disable-PSRemoting -Force
New-PSSession -ComputerName localhostIdentifyEffects of running this cmdlet and Enable-PSRemoting
Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize
Enable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSizeIdentifyLoopback connections with disabled session endpoint configurations
Disable-PSRemoting -Force
New-PSSession -ComputerName localhostIdentifyPrevent remote access to session configurations that have custom security descriptors
Register-PSSessionConfiguration -Name Test -FilePath .\TestEndpoint.pssc -ShowSecurityDescriptorUI -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
New-PSSession -ComputerName localhost -ConfigurationName TestIdentifyRe-enable remote access to selected session configurations
Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize
Set-PSSessionConfiguration -Name Microsoft.ServerManager -AccessMode Remote -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSizeIdentifyIts page in the reference: Disable-PSRemoting.
Parameters
-ForceForces the command to run without asking for user confirmation.-ConfirmPrompts you for confirmation before running the cmdlet.-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.