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.
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.