My goal is to remotely make 2 quick files containing mappings for mapped drives and network printer connections and place the files in the remote c:\temp folder.
When i run the code it applies everything to my own pc. However, if i type each line individually, it works perfect.
side note: I noticed that i had to use the userid and password of the person that was currently logged in to the remote system to get to the point i’m currently at.
$userid= Read-Host 'Enter Userid' $pcname= read-host 'Enter PC Name' Enter-PSSession -ComputerName $pcname -Credential domain\$userid Get-ChildItem -Path HKCU:\Network | Out-File c:\temp\Drives.txt -Force Get-ChildItem -Path HKCU:\Printers\Connections | Out-File c:\temp\printers.txt -Force Exit-PSSession Any ideas why i cant run this all at once? Thanks again! -michael