Hey if anyone can help it would be gratefully appreciated.
I am trying to pass the outputs of file into Update-Ownership command below. to date if will not accept the values.
I have added the write-output only for verification that it is reading the file correctly, which it is as it outputs the right data.
I would prefer to just upload or copy and paste server and user list but this is stage 1. standalone command also works fine. Do I need to create a second for loop ? I have tried to pass outputs to different variables also.
Any Help much appreciated.
$Database = import-csv Database.txt
foreach ($Data in $Database)
{
$servername = $Data.server
$assignuser = $Data.user
write-output $servername
write-output $assignuser
Update-UserOwnership -Machine_id (Get-DesktopVM -Name "$servername").machine_id -Sid (Get-User -Name "$assignuser").sid
}