Help with logon script (Full Version)

All Forums >> [Scripting Technologies] >> VB Script



Message


loungn14 -> Help with logon script (4/29/2008 5:36:43 PM)

Hello,

We are in the process of migrating our kixstart script to vb and have run into a snag...is there anyone who can help??


We have the following lines that I am having a hard time scripting....


---------------------------------------------------------------

   $y=substr(@homedir,3,len(@homedir)-2)
   $y1=instr($y,"\")
   $y2=substr(@homedir,1,$y1+1) ; get home dir server name, no trailing slash
   use X: "$y2"+"\companylcl"             ; Division local common share

'set homeserver variable
$y=substr(@homedir,3,len(@homedir)-2)
$y1=instr($y,"\")
$y2=substr($y,1,$y1-1) ; get home dir server name, no trailing slash
 setm "HOMESERVER=$y2"
-----------------------------------------------------------

Basically, we find the home server of the user (\\servername\user$) and map it as x:\companylcl-- so it would be
x:\ =    \\servername\companylcl

Then we take the same home server variable and set that as a machine variable called HOMESERVER for use in another script and GPO

Any help would be sooooo greatly apprecaited..as we have been scouring the net for days...




akaplan -> RE: Help with logon script (4/30/2008 8:49:44 AM)

I seem to recall saying just because you can  does not mean you should...

dim wshShell,WshNetwork
Dim tArray,strHomeServer

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set wshShell = WScript.CreateObject("WScript.Shell")
Set envSystem = wshShell.Environment("User") 

'create array based on splitting HOMESHARE
tArray = split(wshShell.ExpandEnvironmentStrings("%HOMESHARE%"),"\")
strHomeServer = tArray(2)    'Second element

WshNetwork.MapNetworkDrive "X:","\\"&strHomeServer & "\companylcl"  'map drive

envSystem.item("HomeServer") = strHomeServer   'create the env variable 

Alan





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.25