From 8d582a675f8ad94ea6db1853691f7c1312a90fe6 Mon Sep 17 00:00:00 2001 From: SteveL-MSFT Date: Mon, 17 Jul 2017 09:17:11 -0700 Subject: [PATCH 1/2] Create SessionConfig folder if it doesn't exist for Register-PSSessionConfiguration --- .../engine/remoting/commands/CustomShellCommands.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs index a342219a854..a544c376609 100644 --- a/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs +++ b/src/System.Management.Automation/engine/remoting/commands/CustomShellCommands.cs @@ -964,7 +964,13 @@ private string ConstructPluginContent(out string srcConfigFilePath, out string d } } - string destPath = System.IO.Path.Combine(Utils.DefaultPowerShellAppBase, "SessionConfig", + string destFolder = System.IO.Path.Combine(Utils.DefaultPowerShellAppBase, "SessionConfig"); + if (!Directory.Exists(destFolder)) + { + Directory.CreateDirectory(destFolder); + } + + string destPath = System.IO.Path.Combine(destFolder, shellName + "_" + sessionGuid.ToString() + StringLiterals.PowerShellDISCFileExtension); if (string.Equals(ProcessorArchitecture, "x86", StringComparison.OrdinalIgnoreCase)) { From 79a57935f7b5f2b662978eea063dc543f80ebddd Mon Sep 17 00:00:00 2001 From: SteveL-MSFT Date: Mon, 17 Jul 2017 15:41:59 -0700 Subject: [PATCH 2/2] test is currently pending --- .../Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 index 72247041c87..a5a4d272230 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 @@ -2108,7 +2108,10 @@ Describe "Import-PSSession on Restricted Session" -tags "Feature","RequireAdminO } } - It "Verifies that Import-PSSession works on a restricted session" { + # Blocked by https://github.com/PowerShell/PowerShell/issues/4275 + # Need a way to created restricted endpoint based on a different endpoint other than microsoft.powershell which points + # to Windows PowerShell 5.1 + It "Verifies that Import-PSSession works on a restricted session" -Pending { $errorVariable = $null Import-PSSession -Session $session -AllowClobber -ErrorVariable $errorVariable