store credentials in text file for automating powershell scripts.
Hi All,
we are using asp plugin and running powershell through web interface. Each time instead of entering password we tried the below code to connect o365. Unfortunately the code doesnt works on a 2012 server with ps1x file.
The same code works if we manually copy paste on a powershell window, we can get a session. Also on a windows 7 box the code is working. It is not working only on a windows 2012 with IIS. Is there something we need to enable on the server management so that remote code works.
The error we get is CAS server name access denied.
I will try xml in the web interface and come back to you for any queries.
Thank you so much.
o365Adm
ASKER
HI Limjianan,
unfortunately the xml file also works only on windows 7, when tried the same steps in windows server 2008/2012 we get access denied with a cas server name.
Is there something we need to enable on windows firewall/port/Groupolicy/local security policy so that the cached credentials works fine while requesting from web.
We have IIS server on a windows server which is in a seperate domain and the account we use to authenticate O365 is a pure cloud and not a part of our forest.
Problem is with the IIS application pool. Issue resolved after changing the IIS Application Pool Identity from the default value to a real user account having local admin permissions.
Thank you so much for helping me. I learned many ways of creating powershell session.
you can save the password by
Get-Credential -UserName xxxx -message o365 | Export-Clixml c:\temp\credential-save.xm
reuse the password
$credential = import-clixml c:\temp\credential-save.xm
Import-Module MsOnline
Connect-MsolService -Crede
not sure whether that will save the hassle?