I’m currently writing an automation that pulls data from a queue (an email address) and uses it as a parameter in a PowerShell script to update a security group. The PowerShell script needs to be run as a service account user so I am attempting to invoke PowerShell activity with the output of a read text file activity which starts PowerShell as the service account and then executes a ps script. here is the activity in question:
Thanks for taking a look Surya, i have tested the AddAdobeCC_UIPath.ps1 and the script above that runs it as the service account with arguments from ISE and console it it works perfectly. Initially i had the full path referenced but was getting the same error. I moved the scripts into the root file of the project and put the relative paths in an attempt to troubleshoot.
Ok, I managed to figure it out. because my run_as_admin.ps1 file which invokes the AddAdobeCC_UIPath.ps1 were both in the same \Scripts directory i needed to just call “AddAdobeCC_UIPath.ps1” instead of “\Scripts\AddAdobeCC_UIPath.ps1”.
I did also find that I had not set the permissions correctly on the project folder and the service account didn’t in fact have permissions to the folder. after setting these permissions the process progressed a little further but the PowerShell script still didn’t execute as expected with the following error:
Provider Health: Attempting to perform the NormalizeRelativePath operation on the ‘FileSystem’ provider failed for path c:\path\to\file
If you are experiencing this error - it helps to move your project out of your user directory (I was running my project from My Documents) and run it from c:\temp. I haven’t tested if just moving the ps script to c:\temp will work or if you have to move the whole project, I’ll leave that up to someone else to test and confirm… I’m burnt out.
Thanks Surya for your help, you were able to reassure me that I was moving in the right direction.