Dear All,
I have a folder on my server(windows 2003) that I would like to copy to all computers running Windows XP on a particular subnet. Any one with a script to held me achieve this will be helpful.
Regards,
Dear All,
I have a folder on my server(windows 2003) that I would like to copy to all computers running Windows XP on a particular subnet. Any one with a script to held me achieve this will be helpful.
Regards,
Short summary and a practical option that works without re‑organizing AD.
As hinted, there is no built‑in GPO scope that says “apply to this subnet” directly. A reliable pattern when you cannot move machines into a different OU is to deploy a computer startup script (via a GPO) that checks the machine IP and only performs the copy when the IP falls in your target subnet. Startup scripts run as SYSTEM (they use the computer account to access network shares), so grant the server share read/modify to the Domain Computers group or to the specific computer accounts you need. Also enable the policy “Always wait for the network at computer startup and logon” so the script runs after networking is up.
Example (deploy as a Computer Configuration -> Windows Settings -> Scripts -> Startup script). Edit the variables at the top to match your subnet, UNC source and local destination:
' startup-copy.vbs
Option Explicit
Dim targetPrefix, src, dst, robocopy, objWMI, colAdapters, objAdapter
Dim arrIPs, ip, i, sh, cmd
targetPrefix = "192.168.1." ' change to your subnet prefix
src = "\\SERVER\Share\Folder" ' change to your UNC path
dst = "C:\Target\Folder" ' change to the local destination
robocopy = "C:\Windows\System32\robocopy.exe"
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
Set colAdapters = objWMI.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled = True")
For Each objAdapter in colAdapters
arrIPs = objAdapter.IPAddress
For i = 0 To UBound(arrIPs)
ip = arrIPs(i)
If Left(ip, Len(targetPrefix)) = targetPrefix Then
Set sh = CreateObject("WScript.Shell")
cmd = """" & robocopy & """ """ & src & """ """ & dst & """ /MIR /Z /R:2 /W:5"
sh.Run cmd, 0, True
WScript.Quit
End If
Next
Next Notes and alternatives: test on a few machines first. If robocopy is not present on XP boxes, fall back to xcopy or package robocopy from the Resource Kit. For larger environments, use SCCM/PDQ Deploy/PSExec to push files. WMI filters that try to match IPs are brittle (multiple NICs, VPNs), and Group Policy Preferences item‑level targeting by IP range requires newer GPO infrastructure.
Jump to Post— cguan_77 8did you create a domain for this subnet?
did you create a domain for this subnet?
All computers are on the domain. I just want a policy to apply on this subnet.
you mean you'll try to apply a policy using the subnet mask? i don't know if it's possible to do this.
but why not create an OU and apply a gpo policy to that OU to accomplish the task that you want.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.