Link to home
Start Free TrialLog in
Avatar of YEvans
YEvans

asked on

Accessing remote %systemroot% using UNC

I want to copy a file to or from the %systemroot%\system32 directory on a mix of Windows 2000 and Wndows XP workstations. The systemroot of the Windows 2000 machines is C:\Winnt and the systemroot of the Windows XP machines is C:\Windows. I use a script that loops through a list of workstations, but the repeating command is, for example:

copy \\<hostname>\c$\winnt\system32\logfile.txt

Obviously this will fail on the WIndows XP machines. I would like to use the systemroot variable, but when I try:

copy \\<hostname>\%systemroot%\system32\logfile.txt

it fails because the variable is being resolved on my machine and comes out the wrong syntax anyway (\\<hostname>\c:\winnt...)

How can I use one command that will resolve the remote host's systemroot variable in the copy command? Or what alternatives do I have for accomplishing the same task?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of scampgb
scampgb
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of YEvans
YEvans

ASKER

Man I should have known that! I have gotten so used to just using the C$ and D$ admins shares I forgot all about the admin$ share.

Thanks!
*grin*

Glad I could help :)