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)
Please log in to answer
Posted by:
bkelly
15 years ago
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
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
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
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
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
[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
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.
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
[IS Department]It would be tidier and easier to maintain to do it like this:
Drive1=P,\\sever\roamingprofiles$
Drive2=G,\\server\admin$
Drive3=K,\\server\logon
Drive4=K,\\server\eyeight$
[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.
so that the conversation will remain readable.