# How to allow applications in a PowerShell 3.0 New-PSSessionConfigurationFile?

**URL:** <https://forums.powershell.org/t/how-to-allow-applications-in-a-powershell-3-0-new-pssessionconfigurationfile/2509>\
**Category:** PowerShell Help\
**Created:** [April 28, 2014, 11:25pm UTC](https://forums.powershell.org/t/how-to-allow-applications-in-a-powershell-3-0-new-pssessionconfigurationfile/2509 "2014-04-28T23:25:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter-kriegel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/peter-kriegel/32/326_2.png) [@peter-kriegel](https://forums.powershell.org/u/peter-kriegel)\
**Post date:** [April 28, 2014, 11:25pm UTC](https://forums.powershell.org/t/how-to-allow-applications-in-a-powershell-3-0-new-pssessionconfigurationfile/2509/1 "2014-04-28T23:25:32Z")

</div>

Hi!

I like to allow DOS commands (applications) like Ping.exe or WhoamI.exe inside a Constrained Session.  
Does anybody know how to archive that with PowerShell 3.0 and an .pssc session configuration file created with the cmdlet New-PSSessionConfigurationFile?  
I did not found any documentation on that!

Thank you for your time and answers!  
Peter

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [May 1, 2014, 2:47pm UTC](https://forums.powershell.org/t/how-to-allow-applications-in-a-powershell-3-0-new-pssessionconfigurationfile/2509/2 "2014-05-01T14:47:59Z")

</div>

I don’t think that’s possible in a Session Configuration file (which you might want to report on the Connect site as a bug, if it hasn’t been done already), but Boe Prox recently posted an article that showed how to do it with a startup script instead:

[http://blogs.technet.com/b/heyscriptingguy/archive/2014/04/01/build-constrained-powershell-endpoint-using-startup-script.aspx](http://blogs.technet.com/b/heyscriptingguy/archive/2014/04/01/build-constrained-powershell-endpoint-using-startup-script.aspx)

Look for the bits that use the $PublicApps variable in his code.

---

<div class="post-metadata">

**Author:** ![peter-kriegel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/peter-kriegel/32/326_2.png) [@peter-kriegel](https://forums.powershell.org/u/peter-kriegel)\
**Post date:** [May 4, 2014, 4:44pm UTC](https://forums.powershell.org/t/how-to-allow-applications-in-a-powershell-3-0-new-pssessionconfigurationfile/2509/3 "2014-05-04T16:44:04Z")

</div>

Hi Dave!

Thank you for your Reply!  
I know the very good Post from Boe.

I need the RunAs ability of the 3.0 Endpoints so I have to use the .pssc Config. File.

Next 3 Days I am a Speaker at the German PowerShell Conference so I will be back in 4 Days.  
There I am presenting this Topic.

I have tackled this with an very, very ugly workaround.  
I have wrapped WhoamI.exe inside a PowerShell Function.  
Plus, you have to allow the FileSystem Provider because the Applications lie on the Disk ☹  
I think to allow the FileSystem Provider can open up security wholes?

```
New-PSSessionConfigurationFile -Path "$PSHome\SessionConfig\MyEndpointPS3.pssc" `
-SessionType RestrictedRemoteServer `
-LanguageMode NoLanguage `
-ModulesToImport Microsoft.PowerShell.Management `
-VisibleCmdlets Get-Service,Start-Service,Stop-Service `
-VisibleProviders "FileSystem" `
-FunctionDefinitions @{Name="WhoAmI";ScriptBlock={Invoke-Expression "whoami.exe /user"};Options="AllScope"} `
-VisibleFunctions 'WhoamI'
```

Stay tuned 😉

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [May 5, 2014, 1:10am UTC](https://forums.powershell.org/t/how-to-allow-applications-in-a-powershell-3-0-new-pssessionconfigurationfile/2509/4 "2014-05-05T01:10:57Z")

</div>

I’ll play around with this if I have some spare time soon, and see if I can come up with any other options. I see -RunAsCredential parameters in all three of Register-PSSessionConfiguration’s parameter sets, though; are you saying that it won’t allow you to use RunAsCredential and StartupScript together?

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:52pm UTC](https://forums.powershell.org/t/how-to-allow-applications-in-a-powershell-3-0-new-pssessionconfigurationfile/2509/5 "2024-05-16T20:52:06Z")

</div>

Closed on May 16, 2024, 8:52pm UTC


