Scripting. Powershell, VMware, Windows, Active Directory & Exchange. All that kind of stuff…..
RSS icon Email icon Home icon
  • PowerShell 2.0: One Cmdlet at a Time #41 Disable-PSSessionConfiguration

    Posted on January 19th, 2010 Jonathan Medd No comments

    Continuing the series looking at new cmdlets available in PowerShell 2.0. This time we look at the Disable-PSSessionConfiguration cmdlet.

    What can I do with it?

    Deny access to a session configuration.

    Example:

    Examine the permissions of the previously created PSSessionConfiguration named BITSTransfer. Deny access to this session using Disable-PSSessionConfiguration. Use the Force parameter to supress prompts. Check what the permissions on the configuration have been changed to.

    Get-PSSessionConfiguration -Name BITSTransfer
    | Format-Table -property Name,Permission -auto
    Disable-PSSessionConfiguration -Name BITSTransfer -Force
    Get-PSSessionConfiguration -Name BITSTransfer
    | Format-Table -property Name,Permission -auto

    You will see that you are warned that disabling the PSSessionConfiguration will not undo every change made by Enable-PSRemoting. The effect of running Disable-PSSessionConfiguration is to set the permission Everyone AccessDenied, execpt for BUILTIN\Administrators Access Allowed.

    Disable-PSSessionConfiguration

    Subequently attempting to access that configuration from a remote session results in the following Access Denied error.

    Disable-PSSessionConfiguration2

    How could I have done this in PowerShell 1.0?

    Remoting did not exist in PowerShell 1.0, you would have needed to use Remote Desktop to run an interactive session on a remote server.

    1000 things 1% better!

    Leave a reply