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