Good Afternoon, Just want to start by saying I am totally new with PS, and am really sorry if my approach to this is long winded or inaccurate.
I have a list of computernames that declared as individual Variables that my colleagues have provided me :
$Jon = "Abc1234"
$Mike = "Abc6789"
- another 10 hostnames
I then ask the user if they want to send the files to another PC :
$Targetuser = Read-Host 'Who would you like to send it to?'
What I would like is the output from the above to change to the hostname, but I am unsure of how to do this.
Essentially, if the output was Mike, to change the $targetuser
variable to $Abc6789
Thanks in advance
Dynamically named variables is almost always a bad idea. Instead, use a dictionary type, like a hashtable: