#127942 - 2004-10-15 01:50 AM
if ingroup, vbs, drive mapping
|
JoS
Fresh Scripter
Registered: 2004-10-14
Posts: 6
|
greetings --
(this is long and maybe complicated)
currently i have a kix script that calls a vbscript, to wit:
if ingroup("GroupA") run ("cscript.exe \\server\share$\groupA.vbs") endif
and groupA.vbs looks like:
'map drives On Error Resume Next Dim WshNetwork Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "g:", "\\server\share$\groupA"
set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop & "\Group Share.lnk") oShellLink.TargetPath = WScript.ScriptFullName oShellLink.WindowStyle = 1 oShellLink.TargetPath = "G:\" oShellLink.WorkingDirectory = "G:\" oShellLink.Save
basically this maps drive G:\ to the groupA share and drops a shortcut on the desktop to drive G:\
this works fine but what i would like to do is have 1 vbscript that uses the groupname variable to map the drive and shortcut (so i don't have to create a seperate vbscript for each domain group).
so, can i pass the groupname variable from the kix script to the vbscript? or more ideally - do the entire thing in kix?
thanks for the time and i hope this makes sense!
JoS
|
Top
|
|
|
|
#127944 - 2004-10-15 02:28 AM
Re: if ingroup, vbs, drive mapping
|
JoS
Fresh Scripter
Registered: 2004-10-14
Posts: 6
|
yeah - kix is new to me ... i will axe the parens. do you have any resources that i would find handy for converting that vbs to kix?
tia
|
Top
|
|
|
|
#127947 - 2004-10-15 03:03 AM
Re: if ingroup, vbs, drive mapping
|
JoS
Fresh Scripter
Registered: 2004-10-14
Posts: 6
|
les - great! thanks for the info
i will give it a shot and post back if i need assistance.
|
Top
|
|
|
|
#127948 - 2004-10-15 03:06 AM
Re: if ingroup, vbs, drive mapping
|
ShaneEP
MM club member
   
Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
|
Heres some sample code for you to check out. All in Kix as Les mentioned. The wshshortcut udf came straight from the udf forum here on the board.
Code:
If InGroup("GroupA")
Use G: /Delete /Persistent
Use G: "\\server\share$\groupA"
WshShortCut("%userprofile%\desktop\G Drive.lnk","G:\")
Endif
If InGroup("GroupB")
Use H: /Delete /Persistent
Use H: "\\server\share$\groupB"
WshShortCut("%userprofile%\desktop\H Drive.lnk","H:\")
Endif
function WshShortCut($path,$targetpath,optional $arguments,optional
$startdir,optional $iconpath,optional $style)
dim $shell,$shortcut
$shell=createobject("wscript.shell")
if $shell
$shortcut=$shell.createshortcut($path)
if $shortcut
$shortcut.targetpath=$targetpath
if $arguments
$shortcut.arguments=$arguments
endif
if $startdir
$shortcut.workingdirectory=$startdir
endif
if $iconpath
$shortcut.iconlocation=$iconpath
endif
if $style
$shortcut.windowstyle=$style
endif
$shortcut.save
$shortcut=0
endif
$shell=0
endif
exit @error
endfunction
|
Top
|
|
|
|
#127950 - 2004-10-20 08:24 PM
Re: if ingroup, vbs, drive mapping
|
JoS
Fresh Scripter
Registered: 2004-10-14
Posts: 6
|
i would like to thank this forum! i was able to do the entire script in kix.
again many thanks for the help
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 194 anonymous users online.
|
|
|