1

I am trying to pass a variable to a file name but when the script finishes the file name is blank on the remote machine.

$serv = Read-host 'SERVER NAME'
$Session = New-PSSession -computername $serv 
Invoke-Command -session $session -ScriptBlock {
    reg export HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Shares C:\Users\admin\Desktop\$Serv.reg
}

Thanks for the help

Santiago Squarzon
  • 20,988
  • 4
  • 10
  • 27
junior
  • 11
  • 1

0 Answers0