Please feel free to provide feedback or file bugs here.

WMF 5.1 RestrictedRemoteServer session type fails to import the 'Microsoft.PowerShell.Utility' module

When importing this module in a restricted session type or when making a function or a cmdlet from this module visible, i.e:
VisibleFunctions = 'Get-FileHash'
the following message is returned:
WARNING: The 'Microsoft.PowerShell.Utility' module was not imported because the 'Microsoft.PowerShell.Utility' snap-in was already imported.
In practice, the module is not being imported.
Get-PSSnapin shows that a snapin with the same name is indeed loaded:
Name : Microsoft.PowerShell.Utility
PSVersion : 5.1.14409.1005
Description : This Windows PowerShell snap-in contains utility
cmdlets that are used to view and organize data in different ways.
but exposes no commands
Get-PSSnapin from a regular (not remote) session does not show this snapin.

With default session type everything is working as expected.

12 votes
Sign in
Sign in with: Facebook Google
Signed in as (Sign out)

We’ll send you updates on this idea

Ori Besser shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
needs more information  ·  J. Keith Bankston [MSFT] responded  · 

This report is a bit confusing, so need some information.
On the system where you received this error, please try running any of the commands from Microsoft.PowerShell.Utility, such as get-member, or get-date. The error message and the information you provided seems to indicate that the module is already loaded, so we are looking for other indications that it is not.


Sign in
Sign in with: Facebook Google
Signed in as (Sign out)
  • Julien Nury commented  ·   ·  Flag as inappropriate


    Paul Higinbotham (MSFT) has done some analysis in

    His conclusion: "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
    I believe the fix is to re-write how core modules are loaded in the InitialSessionState.CreateRestrictedForRemoteServer() method."

    As this issue is related to PowerShell 5.1, I think it's the best place for it.

  • Ori Besser commented  ·   ·  Flag as inappropriate

    get-date - works as expected
    get-filehash - "The term 'get-filehash ' is not recognized as the name of a cmdlet, function..."

    Based on your suggestion to run Get-Date (which worked as expected) I further investigated the issue and I can narrow it down to that:
    Exporting any of the cmdlets (like get-date, import-csv..) from 'Microsoft.PowerShell.Utility' module works as expected.
    Exporting any of this module functions (like get-filehash, New-Guid..) results in those functions not being imported at all.
    (I am "exporting" because it is a 'RestrictedRemoteServer' session type which has almost no commands by default)

    In addition, when connecting to this session configuration (enter-pssession), I get the following message if I export any 'Microsoft.PowerShell.Utility' function:
    WARNING: The 'Microsoft.PowerShell.Utility' module was not imported because the 'Microsoft.PowerShell.Utility' snap-in was already imported.
    Again, if I export only cmdlets from 'Microsoft.PowerShell.Utility' I do not get this message.

Feedback and Knowledge Base