Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you use an If statement to set a variable?

Status
Not open for further replies.

elmurado

IS-IT--Management
Jul 15, 2003
673
AU
Hi,
I wanted to use an IF statement to set a variable but don't know if it would work properly.

I want to test if a user belongs to a certain secgroup or not and if they do then
set a variable to TRUE and if they don't then set it to FALSE.

This is to change the PERSISTENT value when mapping network drives via logon script.

Code:
IF (SecGroupObj.Name) = "WorkstationUsers" THEN
PERSISTENT = TRUE
ELSE
PERSISTENT = FALSE
END IF
Then the string will be used in the
Code:
oNetwork.MapNetworkDrive "I:", "\\server\ADMIN",PERSISTENT
line
This is because when laptop users leave the LAN they get problems trying to browse to or attach files because their mapped drives are persistent.
Thanks



 
Which problem do you have with your posted code ?
 
I just wanted to know if it should be okay to work.
I wasn't sure if you can actually do this or not. When I tried it it still set everything as persistent. However, maybe this is because I had the condition in the wrong spot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top