Giter Club home page Giter Club logo

Comments (7)

rpsqrd avatar rpsqrd commented on August 20, 2024

Can you try adding Microsoft.PowerShell.Utility to ModulesToImport in your PSRC? JEA can get funny with dependencies because the module discovery and auto-loading doesn't work the same as it does in a full language session. We generally recommend adding any modules called inside custom scripts or functions to ModulesToImport to ensure they're pre-loaded into the session. You can also try fully qualifying the cmdlet name in your function definition: Microsoft.PowerShell.Utility\Clear-Variable

from jea.

jnury avatar jnury commented on August 20, 2024

Unfortunately it's exactly the same. We tried many different workarounds and never got back functions :-/

from jea.

rpsqrd avatar rpsqrd commented on August 20, 2024

@PaulHigin Any tips for Julien? I'm not sure why the built-in commands would stop working inside custom functions.

from jea.

jnury avatar jnury commented on August 20, 2024

I provided some workarounds on this page: https://jnury.github.io/JEA_term_not_recognized_name_cmdlet/

By the way, I only found 6 functions affected:

  • ConvertFrom-SddlString
  • Format-Hex
  • Get-FileHash
  • Import-PowerShellDataFile
  • New-Guid
  • New-TemporaryFile

These functions are all provided by the Microsoft.PowerShell.Utility module

from jea.

PaulHigin avatar PaulHigin commented on August 20, 2024

I'll take a look.

from jea.

PaulHigin avatar PaulHigin commented on August 20, 2024

@jnury Thanks for reporting this. I am able to reproduce the problem. This is old endpoint configuration code that imports core modules into the restricted session through "snapins". The Microsoft.PowerShell.Utility module consists of binary and script components but snapins only deal with the binary component and leave the script out, which is why the script functions are not available.

I think this is just old legacy code that should be re-written to use module loading rather than snapins.
Can you create an issue on https://github.com/powershell/powershell?
I believe the fix is to re-write how core modules are loaded in the InitialSessionState.CreateRestrictedForRemoteServer() method.

from jea.

jnury avatar jnury commented on August 20, 2024

Thank-you @PaulHigin !
I found this issue on UserVoice: https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/17852350-wmf-5-1-restrictedremoteserver-session-type-fails so just voted and commented on it. If i can reproduce the behaviour on Powershell Core, I'll open an issue on GitHub.

from jea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.