Author Posts

June 19, 2017 at 11:21 am

Hi Team,
I am having a script which maps drives for robocopy and then does changes on a group of files on the destination folder. How do I run this whole script with different credentials depending on the domain. I tried creating a hashtable with diff credentials and then running the script inside invoke-command using credentials parameter but I get below error;
Cannot process argument transformation on parameter 'Credential'. Cannot invoke this function because the current host does not implement it.

Regards,
Kishor

June 19, 2017 at 1:20 pm

Well, without seeing your code, or at least some of it, it's impossible to tell you what the error is referring to.

However, "to run an entire script under different credentials" you would use Start-Process or Invoke-Command. But you can't provide a hash table of credentials to either of those; you need to flat-out provide a credential. You'll probably have to write a "wrapper" script that makes the decision on which credential to use.

June 19, 2017 at 2:18 pm

Hi Don,
Thanks for your time, below is the link for the script;

Regards,
Kishor

June 19, 2017 at 2:23 pm

Another thing to mention is I am running this script in a 'Run .Net' SCO activity which is failing with this error.

Thanks,
Kishor

June 19, 2017 at 8:29 pm

You would need, then, to have SCO running the script under alternate credentials. There's not a way to assert a new identity within the script itself.

June 20, 2017 at 2:07 pm

Thank you Don!