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

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

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
Answered 05/12/2009 by: bkelly
Red Belt

Please log in to comment
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
Answered 05/12/2009 by: TheFergie101
Blue Belt

Please log in to comment
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
Answered 05/12/2009 by: bkelly
Red Belt

Please log in to comment
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.
Answered 06/15/2009 by: SteveVogel
Yellow Belt

Please log in to comment
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.)
Answered 06/15/2009 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity