After
I am trying to connect to MSOL service with powershell
$ username = "UserName @ Domain.com" $ password = "password" $ secure_password = $ password | ConvertTo-SecureString -AsPlainText Force $ credencial = new-object System.Management.Automation.PSCredential ($ username, $ secure_password) Import-Module MSOnline Connect MsolService -Credential a receiving $ credencial MSolGroup -GroupType DistributionList -SearchString "GROUPNAME" | DisplayName, email address, object ID, select string out
and PHP:
$ command = 'powershell -File "' .dirname (__ DIR __) '\\ ps \\ Run .. PS1' '; Exec ($ command, $ output); Print_r ($ generation);
Local PC powerhell script runs without any errors, but with PHP it throws an error:
array ([0] = & gt; type of exception 'Microsoft.Online.Administration.Automation.MicrosoftOnlineEx [1] = & gt; notion was thrown' [2] = & gt; + CategoryInfo :. OperationStopped: (:) [connect MsolService], Mike [3] = & gt; rosoftOnlineException [4] = & gt; + FullyQualifiedErrorId: 0x80090345, Microsoft.Online.Administration.Autom [5] = & gt; ation.ConnectMsolService [6] = & gt; + PSComputerName: s021 [ 7] => [8] = & gt; Before you call any other cmdlets, connect-MsolService cmdlet phone [9] = & gt; ; + CategoryInfo :. OperationStopped: (:) [Get-MsolGroup], Microsoft [10] = & gt; OnlineException [11] = & gt; + FullyQualifiedErrorId: Microsoft .Online.Administration.Automation.Micro [12] = & gt ; Softonlinikssepshn, Maikrosoftkonlain.administreshnkotomeshnkgetgrup [13] = & gt; + Pskomputername: S02l [14] = & gt; [15] = & gt; ) Text after the
Exception reveals: Before you make any call, connect-msolService Cmdlet must call other CMDlets.
Comments
Post a Comment