Forum Discussion
po
Post Prodigy
6 years agousing powershell within service possible?
Hi, Have some powershell code to give us inventory of workspace and reports and run this in powershell. Is it possibe to run powershell scripts directly in servicedesktop without having to ru...
po
Post Prodigy
6 years agoHi,
Thanks for update.
Have ran online to get inventory and works online.
Can now look to scedule.
However, we are currently using
Login-PowerBI
and notice radacad uses get credentials but both involve online entry which won't be possible when schedule.
How can we pass username and password and login to power vbi via script without pop-up box?
Thanks
Anonymous
6 years agoNot applicable
Hi po,
I use the snippet below in my own Audit Logs script, and pass to Task Scheduler. Make sure you use an app password from O365, to avoid having to deal with MFA.
##This is better for scheduled jobs
$User = "[email protected]"
$PWord = ConvertTo-SecureString -String "apppasswordhere" -AsPlainText -Force
$UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PWord
###This will prompt the user for credential
#$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session