What I’m trying to achieve seems very simple. I’m trying to use a PSDrive to plop the contents of a variable into a remote file on a server (obviously this will expand out to many servers once I have it tested). The file path is expanded from the Server Name which is in the variable $SName – and the filename is “servername.ini”. A credential for a known Domain Admin user has been placed in $A.
I created and used the drive using the following:
$IniFile | Set-Content -Path “$SName.ini”
The issue I have is that in the “Set-Content” command, the path of “U” is expanded three times so that I get the following error message:
Can anyone tell me what I’m doing wrong in creating and/or referencing this PSDrive?
Sorry for being a n00b… TIA.
p.s. I have also tried the obvious ‘set-Content -Path “U:$SName.ini” ‘ instead of using “Set-Location”.
You must be logged in to reply to this topic.
Create a free account today to participate in forum conversations, comment on posts and more.