Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9080311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:03:13+00:00 2026-06-16T20:03:13+00:00

I have a very simple powershell script that has a different behaviour depending on

  • 0

I have a very simple powershell script that has a different behaviour depending on if I execute the script locally or remotely through a Invoke-Command / Enter-PSSession . Other scripts work fine. I’m wondering what is different about the environment of a remote session vs. a local session that would cause this difference.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:03:13+00:00Added an answer on June 16, 2026 at 8:03 pm

    Assuming the remote endpoint is set up to use your credentials, the remote session may have a different set of modules available (or different versions), there may be a profile script configured to run for the remote session and the environment is likely to be different. Also note that remote endpoints can be configured to limit access to commands (including applications) as well as restrict the language mode. A script could also walk various variables and functions to limit their visibility as well. If you look at session state you can see some of the properties that can be tweaked when configuring a remoting endpoint e.g.:

    PS> $ExecutionContext.SessionState
    
    
    Drive                         : System.Management.Automation.DriveManagementIntrinsics
    Provider                      : System.Management.Automation.CmdletProviderManagementIntrinsics
    Path                          : System.Management.Automation.PathIntrinsics
    PSVariable                    : System.Management.Automation.PSVariableIntrinsics
    LanguageMode                  : FullLanguage
    UseFullLanguageModeInDebugger : False
    Scripts                       : {*}
    Applications                  : {*}
    Module                        :
    InvokeProvider                : System.Management.Automation.ProviderIntrinsics
    InvokeCommand                 : System.Management.Automation.CommandInvocationIntrinsics
    

    See this article for more info on constrained endpoints. All that said, it is likely you’re using the default endpoint which is usually not constrained. Another difference could be bitness. For instance, you could be running in an x86 shell but connecting to a 64-bit endpoint or vice-versa. If you need to connect to a 32-bit endpoint try the following:

    PS> $s = New-PSSession -cn localhost -ConfigurationName microsoft.powershell32
    PS> icm -Session $s { [IntPtr]::Size }
    4
    PS> Remove-PSSession $s
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have very simple powershell script that starts service remotely. Invoke-Command -Session $session -ScriptBlock
I have a very simple Powershell v1.0 script to kill processes by name: $target
I have a very simple script that creates a user: <?php include 'mysqlserver.php'; session_start();
Have a very simple powershell script to count the number of trades in a
I have a couple of powershell command that are very simple. disable-mailbox dadelgad -confirm:$false
I have a very simple highcharts js chart, which has dates on x-axis and
I have very simple script for submitting the form. This is html template: <table>
I have very simple query that calls a UDF which splits a field by
I have very simple XML in a string that I'm trying to load via
I have very simple method that is being called by performSelector:withObject:afterDelay: however no matter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.