troubleshooting Question

VB Login Script

Avatar of -Matthew-
-Matthew- asked on
Visual Basic Classic
3 Comments1 Solution162 ViewsLast Modified:
I need to convert this over to vbscript and fix a few things on the way. The main one, I need to stop the errors that come up when a drive is already mapped. Would it better to check for the drives existence or remove it then replace it?

I'm using this as an add on file that runs when connected to the vpn after connect.
@echo off
 
net use h: \\tsc72\%username%$
net use t: \\tsc73\collab$
 
ifmember "TSC\AEStaff"
if not %errorlevel% EQU 1 goto Endaestaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\baehare$
:Endaestaff
 
ifmember "TSC\BCStaff"
if not %errorlevel% EQU 1 goto Endbcstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\bcshare$
:Endbcstaff
 
ifmember "TSC\BEStaff"
if not %errorlevel% EQU 1 goto Endbestaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\beshare$
:Endbestaff
 
ifmember "TSC\BMStaff"
if not %errorlevel% EQU 1 goto Endbmstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\bmshare$
:Endbmstaff
 
ifmember "TSC\CEStaff"
if not %errorlevel% EQU 1 goto Endcestaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\ceshare$
:Endcestaff
 
ifmember "TSC\COStaff"
if not %errorlevel% EQU 1 goto Endcostaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\coshare$
:Endcostaff
 
ifmember "TSC\ITStaff"
if not %errorlevel% EQU 1 goto Enditstaff
echo Now mapping Z for the Domain Admins group..
net use n: \\tsc73\itshare$
net use k: \\tsc73\itadmin$
:Enditstaff
 
ifmember "TSC\DEStaff"
if not %errorlevel% EQU 1 goto Enddestaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\deshare$
:Enddestaff
 
ifmember "TSC\ETStaff"
if not %errorlevel% EQU 1 goto Endetstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\etshare$
:Endetstaff
 
ifmember "TSC\HEStaff"
if not %errorlevel% EQU 1 goto Endhestaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\heshare$
:Endhestaff
 
ifmember "TSC\HHStaff"
if not %errorlevel% EQU 1 goto Endhhstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\hhshare$
:Endhhstaff
 
ifmember "TSC\KEStaff"
if not %errorlevel% EQU 1 goto Endkestaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\keshare$
:Endkestaff
 
ifmember "TSC\KMStaff"
if not %errorlevel% EQU 1 goto Endkmstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\kmshare$
:Endkmstaff
 
ifmember "TSC\MCStaff"
if not %errorlevel% EQU 1 goto Endmcstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\mcshare$
:Endmcstaff
 
ifmember "TSC\MEStaff"
if not %errorlevel% EQU 1 goto Endmestaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\meshare$
:Endmestaff
 
ifmember "TSC\MMStaff"
if not %errorlevel% EQU 1 goto Endmmstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\mmshare$
:Endmmstaff
 
ifmember "TSC\OCStaff"
if not %errorlevel% EQU 1 goto Endocstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\ocshare$
:Endocstaff
 
ifmember "TSC\SWStaff"
if not %errorlevel% EQU 1 goto Endswstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\swshare$
:Endswstaff
 
ifmember "TSC\TransStaff"
if not %errorlevel% EQU 1 goto Endtransstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\transportation$
:Endtransstaff
 
ifmember "TSC\WEStaff"
if not %errorlevel% EQU 1 goto Endwestaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\weshare$
:Endwestaff
 
ifmember "TSC\WMStaff"
if not %errorlevel% EQU 1 goto Endwmstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\wmshare$
:Endwmstaff
 
ifmember "TSC\WRStaff"
if not %errorlevel% EQU 1 goto Endwrstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\wrshare$
:Endwrstaff
 
ifmember "TSC\WWStaff"
if not %errorlevel% EQU 1 goto Endwwstaff
echo Now mapping Z for the Domain Admins group..
net use s: \\tsc73\wwshare$
:Endwwstaff
ASKER CERTIFIED SOLUTION
spinzr0

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros