/build/static/layout/Breadcrumb_cap_w.png

KIX Script - Mapping Drives

Guys - Ive got a Kixtart script for logon - but for mapping drives I want to move to a ini file model - so the Kixtart script checks which AD groups a user is in - and then maps the drives for that group from a ini file. I have got some sample/help code but I cant seem to get it working . I dont have any training in KIX and Im quite basic when it comes to coding. I dont want to map drive by mapping the drive within the script. Is any one using an ini file mapping drive model ?

0 Comments   [ + ] Show comments

Answers (5)

Posted by: bkelly 15 years ago
Red Belt
0
Reading values from an INI file is pretty simple in KiXtart...

http://www.adminscripteditor.com/syntax.asp?act=v&id=280

The Syntax is filename, sectionname, valuename so your INI file would look like...

[HR]
Main=H:

And your code something like this...

If InGroup("HR")
$DriveLetter = ReadProfileString("\\server\share\DriveMaps.ini","HR","Main")
Use $DriveLetter "\\server\share\hr"
End If
Posted by: TheFergie101 15 years ago
Blue Belt
0
Thanks Bob - Im looking for the kixscript to look at the AD groups and then map the drives that correspond in the ini file. I dont want to have and server\share coded into the kix script at all.

My ini file looks like this :

[IS Department]
Drive1=P,\\sever\roamingprofiles$
Drive2=G,\\server\admin$
Drive3=K,\\server\logon
Drive4=K,\\server\eyeight$

And my kix code is like this...

If $group<>""
For $x = 1 to 10
$DriveDefinition = ReadProfileString($FileLocation + "\drivemappings.ini", $group, "drive" + $x)
If @ERROR = 0
If $DriveDefinition<>""
ConnectShare($DriveDefinition)
EndIf
Else
Return
EndIf
Next
EndIf
Posted by: bkelly 15 years ago
Red Belt
0
This seems logical and I don't see a problem assuming you have a function named ConnectShare which is handling the comma separated value. One thing that could throw you for a loop is that KiXtart sees $ as a variable by itself. In order to actually display a dollar sign and not have it replaced with a value (probably an empty string), double up on them...

[IS Department]
Drive1=P,\\sever\roamingprofiles$$
Drive2=G,\\server\admin$$
Drive3=K,\\server\logon
Drive4=K,\\server\eyeight$$

Bob
Posted by: SteveVogel 15 years ago
Yellow Belt
0
Some gui implementations of kix scripts may help you with this.

I have a lot of experience using desktop authority .

I used to use some very basic scripts before but this tool was able to solve all scripting tasks like, for example, drive and printer mappings, proxy settings and applications deployment even without any line of handwritten code.
Posted by: anonymous_9363 15 years ago
Red Belt
0
[IS Department]
Drive1=P,\\sever\roamingprofiles$
Drive2=G,\\server\admin$
Drive3=K,\\server\logon
Drive4=K,\\server\eyeight$
It would be tidier and easier to maintain to do it like this: [IS Department]
P=\\server\roamingprofiles$
G=\\server\admin$
K=\\server\logon
L=\\server\eyeight$
and change your loop to walk through the letters D to Z (A to C are reserved, obviously...). if you have a value matching the letter, map it. This way, if some numbskull deletes the entry for, say , Drive2, your script can continue running without the need to error-trap for the missing entry (which your script doesn't currently handle, by the look of it.)
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ