Link to home
Start Free TrialLog in
Avatar of arundelr
arundelr

asked on

Shutdown script copy files if IP address range is in office

Hi Experts,

We have some laptop users and we really do not want to use the Windows Sync function. Seemed to have issues with that so want to make something a bit more custom.. The users Mydocuments folder is stored on their local laptop - we want to take a copy (where changes have happened) but only if the are in the office.

When they are in the office their IP address will be either 192.168.50.X 192.168.51.X or 192.168.52.X. - X obviously will change between .1 - .254

I want to add a little script to the shutdown in group policy which does the following.

1. Check the IP address of the machine, this could be "Local Area Connection" or "Wireless Network Connection"

2. If the IP is within these ranges then I want to say: copy all files from %UserProfile%\My Documents to M:\backup\MyDocuments

3. Copy %UserProfile%\Application Data\Microsoft\Outlook\ *.NK2 and *.pst files to M:\backup\mailarchive\

If the machine IP address is not in the range its safe to presume they are not in office and just let the script die.

When it copies the files it should only copy files which are new or have chaged rather than copying over everything.

Ideally I would like to show some type of popup saying "backing up files now" while the process is running, so that the users know its doing something.

Wow, this quite a task now I write it out, I started looking at how to get the IP address...There seems to be a bit of debate here:
http://www.tek-tips.com/viewthread.cfm?qid=1435334&page=1
https://www.experts-exchange.com/questions/21335206/How-do-I-use-VBScript-to-get-System-Info.html

Please could someone help get me started here

Many thanks

Rob






 
Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

you should configure Active Directory SItes-and-services, add the local subnet...
Then link your GPO to the Site....instead of the OU.

If the computer is not in the site/subnet...it won't run the GPO that contains the script.

http://technet.microsoft.com/en-us/library/cc731907.aspx
Avatar of arundelr
arundelr

ASKER

Hi,

thanks for the fast reply, it's a great suggestion but the thing is that the systems on this site are a mix of laptops and desktops, I only want to setup the script on the laptops.. The laptops are in a seperate OU, I plan to setup the GP only on these laptops
ASKER CERTIFIED SOLUTION
Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America 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