Well, we found out there is basically no remote support for Enter-PSSession, it is meant to be ran interactively. So that is out.
Here is a basic flow... 1. ConfigMgr task sequence starts 2. Commands run on local VM 3. Commands connect to 'jump box' with XenDesktop console installed 4. Commands execute remotely from local VM to jump box utilizing the XenDesktop cmdlets 5. Once complete, task sequence continues The script will look something like this... Powershell.exe -executionpolicy bypass -command "& {invoke-command -computername SERVER01 {Add-PSSnapin Citrix*; Get-BrokerDesktop -DesktopName $computername}}" -ArgumentList $computername Our error is that the PSSnapin will not add when ran inside an invoke-command remotely. Attempting to perform the InitializeDefaultDrives operation on the 'Citrix.Hypervisor' provider failed. The drive in question is XdHyp. When we do an Enter-PSSession or run it locally on the server it works fine. Daniel Ratliff From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of Michael B. Smith Sent: Tuesday, September 30, 2014 3:25 PM To: powershell@lists.myitforum.com Subject: [powershell] RE: Pipe a command to Enter-PSSession? I need to know more/better understand what you are trying to do. Give us a desire command flow. From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Daniel Ratliff Sent: Tuesday, September 30, 2014 2:34 PM To: powershell@lists.myitforum.com<mailto:powershell@lists.myitforum.com> Subject: [powershell] Pipe a command to Enter-PSSession? Trying to do some remote work inside a ConfigMgr task sequence, using Run Command Line. Powershell.exe -ExecutionPolicy Bypass -command "& {enter-pssession -computername SERVER01}" I need to be able to feed commands into the session. Here is the catch, we can't use invoke-command -session $session because we need to add the XenDesktop cmdlets, and invoke-command does not create the XdHyp psdrive. Does anyone know a way to pass commands to a PSSession in a single line? Daniel Ratliff The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information. ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1 The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information. ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1