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:-
- Is it correct to do like this ?
- Can customer turn this off somewhere (in which case all my scripts will fail) ?
- How to achieve the same in remote runspace against exchange online (I have different runspace for exch online) ?
Thanks.