Page 1 of 1 1
Topic Options
#76226 - 2003-07-30 05:23 AM Mapping Drives via INI file
dataman_42 Offline
Lurker

Registered: 2003-07-30
Posts: 3
Loc: NSW Australia
I will try this again.
I am trying to map drive for groups in a domain via an INI file. I have been using Diederik de Groot login.ix and am modifying as required.

I am trying to get the variable $group to change by using EnumGroup function with no success. It sees the groups but will no connect drives.

Any help would be appreciated.

code:
Function ConnectGroupDrives()
;******************************
; GroupShares
;******************************

;Initialise $group so it is not empty

$group=0

If Exist($FileLocation + "\shares.ini")
If $group=0
For $x = 1 to 10
$group = EnumGroup($Index)
$Index=$Index+1
$DriveDefinition = ReadProfileString($FileLocation + "\shares.ini", $group, "drive" + $x)
If @ERROR = 0
If $DriveDefinition<>""
ConnectShare($DriveDefinition)
EndIf
Else
Return
EndIf

Next
EndIf
EndIf
EndFunction

SAMPLE Share.ini file
[MAPAll]
Drive1="F:, \\Server1\PUBLIC, MAPAll"

[CompServAdmin]
Drive1="J:, \\Server1\CCshare,CCshare"
Drive2="K:, \\Server1\e$,E"
Drive3="L:, \\Server1\c$,C"

TIA [Smile]

[ 30. July 2003, 05:23: Message edited by: dataman_42 ]
_________________________
dataman

Top
#76227 - 2003-07-30 01:47 PM Re: Mapping Drives via INI file
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Dataman,
Peerhaps I confused you on your other post...

The UDF forum is not a place to discuss problems with someone else's UDF but rather, a place to share UDFs of your own creation. There are also strict guidelines to be followed for UDFs. That said, a moderator will move this thread.

Last time you posted a snippet of code that did not include the UDF. This time you posted just one of the UDFs without the callin code. You also failed to post the ConnectShare() UDF that this UDF calls.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#76228 - 2003-07-30 02:08 PM Re: Mapping Drives via INI file
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
dataman,

Did you get a chance to look at this?

I think this covers what you need in your request - ENUMINI() - Enumerate an INI file

It is really a MapDrive() UDF, but uses an INI database.

Note: It does not work with shares that have a space within them.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#76229 - 2003-07-30 02:18 PM Re: Mapping Drives via INI file
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Looking at what code there is posted...

In your function you have:
$group=0
...
ReadProfileString($FileLocation + "\shares.ini", $group, "drive" + $x)

The syntax is supposed to be:
ReadProfileString ("file name", "section", "key")

I cannot see where $group is valid as a section name.

Also, have to wonder why the data in the INI is wrapped in quotes but not seeing the ConnectShare() UDF, all I can do is wonder. [Confused]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#76230 - 2003-07-30 02:47 PM Re: Mapping Drives via INI file
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See the UDF Forum under ArrayEnumGroup() - Creates an array of groups of which the current user is a member

The following is an .INI file structure I am using for drive mappings
code:
; Mandatory drive shares for users
;
; Format:
;
;[UNC]
;Drive = drive letter to which the UNC name will be mapped
;Label = optional label for Windows 2000/XP/2003
;GroupInclude = User groups to be included in the drive share
;CompExclude = Computers to be excluded from the drive share
;UserInclude = Users to be included in the drive share
;NetworkType = Type of network connection allowed for this share (LOCAL, LAN, VPN, DIALUP)
;Persistent = True if mapping is persistent
;DenyGuestAccess = True if guests are not allowed to access this share

It uses the MapDrive() and IsIncluded() UDFs and an identifyer for the network connection type based on specific network segments as identified by NetworkID and Subnet Mask.

[ 30. July 2003, 14:49: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 675 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.089 seconds in which 0.061 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org