Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

C# Runspace InitialState.LanguageMode set to PSLanguageMode.FullLanguage - any side effects ?

$
0
0

Hello All - I am developing a C# client to office 365 where I would like to manage my tenant data including exchange online.

In the process I create a runspace as below:-

            InitialSessionState InitialState = InitialSessionState.Create();
            InitialState.ImportPSModule(new string[] { Office365Utils.MSONLINE });
            //i think i need make this configurable, check later
            InitialState.LanguageMode = PSLanguageMode.FullLanguage;
            _runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(InitialState);
            _runspace.Open();

By setting  InitialState.LanguageMode to PSLanguageMode.FullLanguage, I am able to execute any scripts including variable declaration, assignment etc... My question's are:-

  1. Is it correct to do like this ?
  2. Can customer turn this off somewhere (in which case all my scripts will fail) ?
  3. How to achieve the same in remote runspace against exchange online (I have different runspace for exch online) ?

Thanks.


Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>