The goal is to execute 2 commands on a remote computer by entering the credentials only once. I searched for examples multiple times already, read Microsoft’s site about cim session but did not yet manage to realize this. Also, I read a thread about it in this forum, did not help.
Does anyone have a simple example that does exactly what I want? I would like to enter the user/pwd only once and execute with these credentials multiple commands on a remote server. Something pretty basic.
Because it gives me the following error when I use it the way you proposed it:
Copy-Item : Cannot retrieve the dynamic parameters for the cmdlet. The FileSystem provider supports credentials only
on the New-PSDrive cmdlet. Perform the operation again without specifying credentials.