How to pause a startup script during a VPN event?

David VanZandt
David VanZandt used Ask the Experts™
on
Hi all, when I log onto my PC at work, my startup folder includes a PowerShell script. The script simply checks whether certain network drives are mapped; and if not, then map them. When I work from home, however, I have to VPN and manually authenticate before the network drives are revealed to me. I can add a time delay to my script, or wait for a manual key press.

I am thinking that the delay can be automated, possibly with a wait condition. Perhaps a ping to an IP address inside the firewall. If you have any suggestions to improve this, please let me know. One limitation, I do not have admin privileges on the PC.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Can your VPN client run a script? That would be a good way to manage this. I use NCP Secure Entry and it can do that.
David VanZandtOracle Database Administrator III

Author

Commented:
No, but thanks for the suggestion. :)
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Put in a WAIT for 15 seconds and that would accommodate the VPN connection.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
Pinging is something I do myself for this purpose. It 8s better than just waiting for a fixed time.
Oracle Database Administrator III
Commented:
John mentioned using a script in the VPN connection, which led me to explore the wealth of alternatives at Cisco (see <https://www.google.com/search?client=firefox-b-1-ab&q=anyconnect+script+map+network+drive&sa=X&ved=2ahUKEwjJj5S16pHhAhVsnuAKHZImAy0Q1QIoAXoECAoQAg&biw=1920&bih=905>. In particular I turned to PowerShell, using the OnConnect cmdlet to execute a script that's triggered by a successful connection). I'll share the final solution if I get permission.  Thanks to both of you.
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial