myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


           



Help with logon script

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Scripting Technologies] >> VB Script >> Help with logon script Page: [1]
Login
Message << Older Topic   Newer Topic >>
Help with logon script - 4/29/2008 5:36:43 PM   
loungn14

 

Posts: 9
Score: 0
Joined: 6/23/2006
Status: offline
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...
Post #: 1
RE: Help with logon script - 4/30/2008 8:49:44 AM   
akaplan


Posts: 168
Score: 20
Joined: 4/22/2003
From: North Carolina
Status: offline
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


(in reply to loungn14)
Post #: 2
Page:   [1]
All Forums >> [Scripting Technologies] >> VB Script >> Help with logon script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.180