Gotcha: GUID for Session Configuration

I’m currently working on a small project that will use constrained remoting endpoints together with RunAs credentials. It all went fine until I decided to change part of configuration for a moment to test something. I’m using PSSession Configuration Files all the time, so I decided I will create a new one, different from the one used before and just change configuration of endpoint using Set-PSSessionConfiguration cmdlet.

I tried  once, twice… but nothing really changed. And eventually it hit me.

When you create new configuration file with cmdlet designed for it and you do not specify GUID for this file – PowerShell will generate one for you. It’s fine when you are registering new configuration. But when you are trying to change existing one with it you will get no results (errors, warnings). And it won’t work either. Why? Well, GUID of the new configuration file has to match with GUID of registered configuration, that’s all… Uśmiech It may sound obvious, but took me a few minutes to figure it out. Eventually I used snippet like that to create configuration file “valid” for updating my endpoint X:

$Options = @{            
    Path = 'NewConfig.pssc'            
    GUID = (Get-PSSessionConfiguration -Name X).GUID            
}            

New-PSSessionConfigurationFile @Options

Once I’ve edited the file and made necessary changes I could use it to set configuration for my endpoint.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s