Question Locked

Batch Backup works, help with VPN

0 helpful
15 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi guys, I wrote a question couple of days ago, which entiled me putting a pst.bat in the logoff script for various users in AD. This worked great and for selected users, their PST files gets backuped every time.

Only thing is we have a number of users that connect to our network via VPN for their emails, but as you can imagine the script is still running and causing problems for these users...

Can or is there a way in the bat file to check if the laptop is on our network/whether I can use the IF and GOTO commands to skip the sript if on vpn??

Many Thanks in Advance

15 replies

by rob mekel

but you could try ruling them out (is that is what you want) on basis of their IP-adres
Alltho a VPN the original IP-adres is still not one of your DNS IP-adres-range.

Or on getting in by VPN ... set a parameter you can check on leaving, letting you know they are a VPN-login-account :)

or ...

There are numerous of way's to do this.

[i]their versus there are or they're or even, as in this case, they are[/i]

by wizard-09

Maybe set a block of IP's in the DHCP for VPN then rule them out only way i can think of doing it.

by j_parks81

Yes that is the sort of thing I am after, when users in the office, all is fine. When certain users take off on business, they use their wireless for net, once on net, VPN is connected to here.

Because connected with VPN, when logoff/shutdown, the script still runs, as AD registers the logoff/shutdown.

Can you shed any light on the parameters for leaving??

Im little hasty to add the script for these users until I know it will work fully!!

Thanks for your quick response guys!!

by wizard-09

Have you not got OWA for exchange server?

So they can connect into the OWA web version and there for no need for the edited bat file?

Just a thought?

Edit me being thick again near end of day lol, its not the point the point is its still getting backup when the log out because they are VPN into the network so that script will run note taken ha ha

by j_parks81

We have thought of OWA, it would make sense, we could bin the whole VPN process then......But like ou say I haven't tried it so not sure how the whole 'archive' scenario would work......

My .bat file works like a treat, copys the pst, creates user folder on backup share etc....I tried over the VPN last few nites, and I am still getting 'running scripts' during shutdown/logoff.....

In all fairness Im still learning with the whole script/bat process....

Thanks again :?)

by wizard-09

Can you post your bat/script removing all data that may not be needed like users names and ip address so i have something to work with just use *** to replace any info you don't want anyone to see but at lease i have something to work with then.

by j_parks81

Hey many thanks for your time, much appreciated :)

by j_parks81

@echo off
net use \\a***a\f$ /USER:administrator **password**
cls
@ping 127.0.0.1 -n 3 >nul
title ******************************************BACKUP EMAIL ARCHIVES********************************************
cd\
taskkill /im outlook.exe /t
@ping 127.0.0.1 -n 10 >nul
IF NOT EXIST "\\A***A\f$\%username%" md \\A***A\f$\%username%
xcopy /C /S /Q /H /I /Y "%USERPROFILE%\local settings\APPLICATION DATA\microsoft\outlook\*.pst" \\A***A\f$\%username%
echo ************* >> \\a***a\f$\%username%\%username%_LOG.TXT
date /t >>\\a***a\f$\%username%\%username%_LOG.TXT
time /t >>\\a***a\f$\%username%\%username%_LOG.TXT
@ping 127.0.0.1 -n 5 >nul

Just for the record, it was going to be a little fileon users desktops, hence the ping timeouts and the title etc..

Thanks again!!

by wizard-09

Like everything it might not look pretty but it sure as hell does the job lol.

by wizard-09

Ok i have just logged onto one of my DC's have had a look at the tab's in question for VPN access.

There is an option to give the users a static address from a pool of IP addresses is this something that you will be doing before i start writen the code for it?

by wizard-09

I have been trying to work this out using a bat script but can't seem to get it to work think that someone could maybe do this with a VB script which i don't no, somethink that could check how your logged in and if using VPN then not to process or call the .bat file you have.

Just a question to clear things up, how is the shutdown script running on a remote machine or local machine with GPO?

You would need somthing like this

IF ($subnet = " 92" OR $subnet = " 97")
GOTO END

Put we would need this for IP range like you said 172 or something like that.
I will not be beat, i will continue to look for something that suits.

by j_parks81

That is something that stumps me, I've created a group, with select users in the group. I have included in a GPO a logoff scipt. When logoff, script gets run and backs up file.

I tried this with just myself in the group, and tried the VPN when I was at home, sure enough once vpn is connected, logoff tries running the script, and caused laptop to lockup.

Same thing happens if I disable the VPN then logoff.

Its as tho the logoff script gets put on the local machine in cache maybe??

From research on web I am starting to think I may have to look into the world of 'VB'!!!!

Its only 4-5 users that need this particular script, so I may leave them out of the group and have the bat file on their desktop just for hwne they in office

by j_parks81

The majority of our users use DHCP, which happens to be on a differetn server to the DC, strange I know but this was implemented before I got here!!!

When certain users are using VPN, they have a local IP (home network/router etc) and a virtual adapter which is usually 172******.

I cant seem to find these tabs in AD, but I probably wont be assigning static IP's to the users.

Cheers

by wizard-09

Is because it has disconnected from the network via the VPN there for the GPO cannot run it hangs and as default the VPN will disconnect after 5 to 10 mins this is what your seeing happening thats way i asked if the GPO was local or remote and way i am having problems trying to come up with something.

Yes it does look like a VB script is needed i dont do VB so i really can't help do i am sure someone else could maybe write the file for you if you post it again asking for a vb script hope you get it sorted sorry i could not be of more help.

This discussion is closed to new replies.