Author |
Message |
Karl #1 / 12
|
 Login Script Problems
I am trying to get the following login script. The problem I'm having is that I get an error message when the script tries to map the H: drive stating that the path is invalid. Thanks in advance for any help on this. ********************************************************** Set objNetwork = Wscript.CreateObject("WScript.Network") Set objFS = CreateObject("Scripting.FileSystemObject") if objFS.DriveExists("H:") then objNetwork.RemoveNetworkDrive "H:",true end if if objFS.DriveExists("P:") then objNetwork.RemoveNetworkDrive "P:",true end if if objFS.DriveExists("S:") then objNetwork.RemoveNetworkDrive "S:",true end if objNetwork.MapNetworkDrive "H:", "\\server1\%username%" objNetwork.MapNetworkDrive "P:", "\\server1\apps" objNetwork.MapNetworkDrive "S:", "\\server1\library" *********************************************************
|
Tue, 29 Nov 2005 02:17:56 GMT |
|
 |
Joseph Acost #2 / 12
|
 Login Script Problems
1. Do you have a share configured for every users username on server1 that will run this logon script? 2. Also, I don't believe VBScript isn't going to understand the CMD variable in the method that is being used. Add something like this at the top of your script. Dim ws: Set ws = CreateObject("Wscript.Shell") Dim username: username = ws.ExpandEnvironmentStrings("%USERNAME%") Then change this objNetwork.MapNetworkDrive "H:", "\\server1\%username%" to this objNetwork.MapNetworkDrive "H:", "\\server1\username"
Quote: > I am trying to get the following login script. The problem I'm having is > that I get an error message when the script tries to map the H: drive > stating that the path is invalid. Thanks in advance for any help on this. > ********************************************************** > Set objNetwork = Wscript.CreateObject("WScript.Network") > Set objFS = CreateObject("Scripting.FileSystemObject") > if objFS.DriveExists("H:") then > objNetwork.RemoveNetworkDrive "H:",true > end if > if objFS.DriveExists("P:") then > objNetwork.RemoveNetworkDrive "P:",true > end if > if objFS.DriveExists("S:") then > objNetwork.RemoveNetworkDrive "S:",true > end if > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > objNetwork.MapNetworkDrive "S:", "\\server1\library" > *********************************************************
|
Tue, 29 Nov 2005 03:29:53 GMT |
|
 |
Joseph Carlisl #3 / 12
|
 Login Script Problems
You can not directly access environment variables in vbscript. Instead you need to use the WshShell object. It has a method ExpandEnvironmentStrings which you can use to read that variable. ''''''''''''''''''''''''''''''''''''''' dim objWshShell dim strUserName set objWshShell = CreateObject("WScript.Shell") strUserName = objWshShell.ExpandEnvironmentStrings("%USERNAME%") ''''''''''''''''''''''''''''''''''''''' For Win9x machines you need to create a loop and preform some additional tests. ''''''''''''''''''''''''''''''''''''''' Do Until sUserName <> "" Or iTimeOut = 60 iTimeOut = iTimeOut + 1 strUserName = objWshShell.ExpandEnvironmentStrings("%USERNAME%") Wscript.Sleep 500 Loop ''''''''''''''''''''''''''''''''''''''' (links may wrap) WshShell reference http://msdn.microsoft.com/library/default.asp?url=/library/en-us/scri... WshShell ExpandEnvironmentStrings Method http://msdn.microsoft.com/library/default.asp?url=/library/en-us/scri... -josephc
|
Tue, 29 Nov 2005 03:31:33 GMT |
|
 |
Robert Cohe #4 / 12
|
 Login Script Problems
what I actually perfer is to put the user drive in the active directory and not running it in script each time. For example, I this morning no less changes everyone's homedirectory location through this. Set ObjOU= GetObject("LDAP://ou=staff,DC=baltimorebehavioralhealth,DC=org") For Each ObjUser In ObjOU ObjUser.Put "HomeDirectory", "\\bbh\dfs\users\" & objUser.sAMAccountName objUser.Put "HomeDrive", "U:" objUser.SetInfo next --
need to e-mail me off list just get rid of "your fears" and drop me a line.
Quote: > 1. Do you have a share configured for every users username on server1 that > will run this logon script? > 2. Also, I don't believe VBScript isn't going to understand the CMD > variable in the method that is being used. > Add something like this at the top of your script. > Dim ws: Set ws = CreateObject("Wscript.Shell") > Dim username: username = ws.ExpandEnvironmentStrings("%USERNAME%") > Then change this > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > to this > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > I am trying to get the following login script. The problem I'm having is > > that I get an error message when the script tries to map the H: drive > > stating that the path is invalid. Thanks in advance for any help on this. > > ********************************************************** > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > Set objFS = CreateObject("Scripting.FileSystemObject") > > if objFS.DriveExists("H:") then > > objNetwork.RemoveNetworkDrive "H:",true > > end if > > if objFS.DriveExists("P:") then > > objNetwork.RemoveNetworkDrive "P:",true > > end if > > if objFS.DriveExists("S:") then > > objNetwork.RemoveNetworkDrive "S:",true > > end if > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > *********************************************************
|
Tue, 29 Nov 2005 04:09:14 GMT |
|
 |
Karl #5 / 12
|
 Login Script Problems
Thanks for all of your help. I think I am almost there but I am still getting an error message stating that the path is invalid even though the directory is there and shared out properly. For debugging purposes, how would I display the value of %username% in this script?
Quote: > 1. Do you have a share configured for every users username on server1 that > will run this logon script? > 2. Also, I don't believe VBScript isn't going to understand the CMD > variable in the method that is being used. > Add something like this at the top of your script. > Dim ws: Set ws = CreateObject("Wscript.Shell") > Dim username: username = ws.ExpandEnvironmentStrings("%USERNAME%") > Then change this > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > to this > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > I am trying to get the following login script. The problem I'm having is > > that I get an error message when the script tries to map the H: drive > > stating that the path is invalid. Thanks in advance for any help on this. > > ********************************************************** > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > Set objFS = CreateObject("Scripting.FileSystemObject") > > if objFS.DriveExists("H:") then > > objNetwork.RemoveNetworkDrive "H:",true > > end if > > if objFS.DriveExists("P:") then > > objNetwork.RemoveNetworkDrive "P:",true > > end if > > if objFS.DriveExists("S:") then > > objNetwork.RemoveNetworkDrive "S:",true > > end if > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > *********************************************************
|
Tue, 29 Nov 2005 05:08:14 GMT |
|
 |
Robert Cohe #6 / 12
|
 Login Script Problems
that is the problem you can't use %username% in a vb script. --
need to e-mail me off list just get rid of "your fears" and drop me a line.
Quote: > Thanks for all of your help. I think I am almost there but I am still > getting an error message stating that the path is invalid even though the > directory is there and shared out properly. For debugging purposes, how > would I display the value of %username% in this script?
> > 1. Do you have a share configured for every users username on server1 > that > > will run this logon script? > > 2. Also, I don't believe VBScript isn't going to understand the CMD > > variable in the method that is being used. > > Add something like this at the top of your script. > > Dim ws: Set ws = CreateObject("Wscript.Shell") > > Dim username: username = ws.ExpandEnvironmentStrings("%USERNAME%") > > Then change this > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > to this > > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > > I am trying to get the following login script. The problem I'm having > is > > > that I get an error message when the script tries to map the H: drive > > > stating that the path is invalid. Thanks in advance for any help on > this. > > > ********************************************************** > > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > > Set objFS = CreateObject("Scripting.FileSystemObject") > > > if objFS.DriveExists("H:") then > > > objNetwork.RemoveNetworkDrive "H:",true > > > end if > > > if objFS.DriveExists("P:") then > > > objNetwork.RemoveNetworkDrive "P:",true > > > end if > > > if objFS.DriveExists("S:") then > > > objNetwork.RemoveNetworkDrive "S:",true > > > end if > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > > *********************************************************
|
Tue, 29 Nov 2005 05:11:55 GMT |
|
 |
Robert Cohe #7 / 12
|
 Login Script Problems
but if you are talking using below like the one post: username = ws.ExpandEnvironmentStrings("%USERNAME%") then just put after it msgbox (username) that will show you the value of username in a popup --
need to e-mail me off list just get rid of "your fears" and drop me a line.
Quote: > Thanks for all of your help. I think I am almost there but I am still > getting an error message stating that the path is invalid even though the > directory is there and shared out properly. For debugging purposes, how > would I display the value of %username% in this script?
> > 1. Do you have a share configured for every users username on server1 > that > > will run this logon script? > > 2. Also, I don't believe VBScript isn't going to understand the CMD > > variable in the method that is being used. > > Add something like this at the top of your script. > > Dim ws: Set ws = CreateObject("Wscript.Shell") > > Dim username: username = ws.ExpandEnvironmentStrings("%USERNAME%") > > Then change this > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > to this > > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > > I am trying to get the following login script. The problem I'm having > is > > > that I get an error message when the script tries to map the H: drive > > > stating that the path is invalid. Thanks in advance for any help on > this. > > > ********************************************************** > > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > > Set objFS = CreateObject("Scripting.FileSystemObject") > > > if objFS.DriveExists("H:") then > > > objNetwork.RemoveNetworkDrive "H:",true > > > end if > > > if objFS.DriveExists("P:") then > > > objNetwork.RemoveNetworkDrive "P:",true > > > end if > > > if objFS.DriveExists("S:") then > > > objNetwork.RemoveNetworkDrive "S:",true > > > end if > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > > *********************************************************
|
Tue, 29 Nov 2005 05:13:35 GMT |
|
 |
Karl #8 / 12
|
 Login Script Problems
I just displayed the value using msgbox(username) and it is being set correctly. However, the script is having problems with the following line: objNetwork.MapNetworkDrive "H:", "\\server1\username" I think it may actually be looking for the share name \\server1\username and not plugging in the actual user's name. Is the syntax incorrect?
Quote: > but if you are talking using below like the one post: > username = ws.ExpandEnvironmentStrings("%USERNAME%") > then just put after it > msgbox (username) > that will show you the value of username in a popup > --
> need to e-mail me off list just get rid of "your fears" and > drop me a line.
> > Thanks for all of your help. I think I am almost there but I am still > > getting an error message stating that the path is invalid even though the > > directory is there and shared out properly. For debugging purposes, how > > would I display the value of %username% in this script?
> > > 1. Do you have a share configured for every users username on server1 > > that > > > will run this logon script? > > > 2. Also, I don't believe VBScript isn't going to understand the CMD > > > variable in the method that is being used. > > > Add something like this at the top of your script. > > > Dim ws: Set ws = CreateObject("Wscript.Shell") > > > Dim username: username = ws.ExpandEnvironmentStrings("%USERNAME%") > > > Then change this > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > to this > > > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > > > I am trying to get the following login script. The problem I'm having > > is > > > > that I get an error message when the script tries to map the H: drive > > > > stating that the path is invalid. Thanks in advance for any help on > > this. > > > > ********************************************************** > > > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > > > Set objFS = CreateObject("Scripting.FileSystemObject") > > > > if objFS.DriveExists("H:") then > > > > objNetwork.RemoveNetworkDrive "H:",true > > > > end if > > > > if objFS.DriveExists("P:") then > > > > objNetwork.RemoveNetworkDrive "P:",true > > > > end if > > > > if objFS.DriveExists("S:") then > > > > objNetwork.RemoveNetworkDrive "S:",true > > > > end if > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > > > *********************************************************
|
Tue, 29 Nov 2005 05:42:21 GMT |
|
 |
Robert Cohe #9 / 12
|
 Login Script Problems
right because it needs to be objNetwork.MapNetworkDrive "H:", "\\server1\" & username you can't put username in the quote because it will put "username" and not the value of username --
need to e-mail me off list just get rid of "your fears" and drop me a line.
Quote: > I just displayed the value using msgbox(username) and it is being set > correctly. However, the script is having problems with the following line: > objNetwork.MapNetworkDrive "H:", "\\server1\username" > I think it may actually be looking for the share name \\server1\username and > not plugging in the actual user's name. Is the syntax incorrect?
> > but if you are talking using below like the one post: > > username = ws.ExpandEnvironmentStrings("%USERNAME%") > > then just put after it > > msgbox (username) > > that will show you the value of username in a popup > > --
> > need to e-mail me off list just get rid of "your fears" and > > drop me a line.
> > > Thanks for all of your help. I think I am almost there but I am still > > > getting an error message stating that the path is invalid even though > the > > > directory is there and shared out properly. For debugging purposes, how > > > would I display the value of %username% in this script?
> > > > 1. Do you have a share configured for every users username on server1 > > > that > > > > will run this logon script? > > > > 2. Also, I don't believe VBScript isn't going to understand the CMD > > > > variable in the method that is being used. > > > > Add something like this at the top of your script. > > > > Dim ws: Set ws = CreateObject("Wscript.Shell") > > > > Dim username: username =
ws.ExpandEnvironmentStrings("%USERNAME%") Quote: > > > > Then change this > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > to this > > > > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > > > > I am trying to get the following login script. The problem I'm > having > > > is > > > > > that I get an error message when the script tries to map the H: > drive > > > > > stating that the path is invalid. Thanks in advance for any help on > > > this. > > > > > ********************************************************** > > > > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > > > > Set objFS = CreateObject("Scripting.FileSystemObject") > > > > > if objFS.DriveExists("H:") then > > > > > objNetwork.RemoveNetworkDrive "H:",true > > > > > end if > > > > > if objFS.DriveExists("P:") then > > > > > objNetwork.RemoveNetworkDrive "P:",true > > > > > end if > > > > > if objFS.DriveExists("S:") then > > > > > objNetwork.RemoveNetworkDrive "S:",true > > > > > end if > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > > > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > > > > *********************************************************
|
Tue, 29 Nov 2005 06:13:53 GMT |
|
 |
Richard Mueller [MVP #10 / 12
|
 Login Script Problems
Hi, You can use the WshShell object to retrieve the value of the environment variable %username%, but I always use the WshNetwork object instead. Partly, this is because %username% is not found on Win9x clients. Set objNetwork = CreateObject("Wscript.Network") strNTName = objNetwork.UserName objNetwork.MapNetworkDrive "H:", \\Server1\ & strNTName Just to complicate things, if the client is Win9x, you need a loop to retrieve UserName from WshNetwork. The loop is only needed during logon - it forces authentication to complete. Here is the loop I've used for years on all clients: Set objNetwork = CreateObject("Wscript.Network") ' Loop required for Win9x clients during logon. strNTName = "" On Error Resume Next Err.Clear Do While strNTName = "" strNTName = objNetwork.UserName Err.Clear If Wscript.Version > 5 Then Wscript.Sleep 100 End If Loop On Error GoTo 0 Finally, if the home drive is specified for the user in Active Directory, as was suggested, it will be mapped automatically if the client is NT or above, but not on Win9x clients. For all clients, I use: ' Map user home directory. strHomeShare = objUser.homeDirectory If strHomeShare <> "" Then strHomeDrive = objUser.homeDrive If strHomeDrive = "" Then strHomeDrive = "H:" End If On Error Resume Next Err.Clear objNetwork.MapNetworkDrive strHomeDrive, strHomeShare If Err.Number <> 0 Then Err.Clear On Error GoTo 0 objNetwork.RemoveNetworkDrive strHomeDrive, True, True objNetwork.MapNetworkDrive strHomeDrive, strHomeShare End If On Error GoTo 0 End If The above assumes you have bound to the user object with the LDAP provider. Respond if you need help doing that. -- Richard Microsoft MVP Scripting and ADSI http://www.rlmueller.net --
Quote: > right because it needs to be > objNetwork.MapNetworkDrive "H:", "\\server1\" & username > you can't put username in the quote because it will put "username" and not > the value of username > --
> need to e-mail me off list just get rid of "your fears" and > drop me a line.
> > I just displayed the value using msgbox(username) and it is being set > > correctly. However, the script is having problems with the following > line: > > objNetwork.MapNetworkDrive "H:", "\\server1\username" > > I think it may actually be looking for the share name \\server1\username > and > > not plugging in the actual user's name. Is the syntax incorrect?
> > > but if you are talking using below like the one post: > > > username = ws.ExpandEnvironmentStrings("%USERNAME%") > > > then just put after it > > > msgbox (username) > > > that will show you the value of username in a popup > > > --
> > > need to e-mail me off list just get rid of "your fears" and > > > drop me a line.
> > > > Thanks for all of your help. I think I am almost there but I am still > > > > getting an error message stating that the path is invalid even though > > the > > > > directory is there and shared out properly. For debugging purposes, > how > > > > would I display the value of %username% in this script?
> > > > > 1. Do you have a share configured for every users username on > server1 > > > > that > > > > > will run this logon script? > > > > > 2. Also, I don't believe VBScript isn't going to understand the CMD > > > > > variable in the method that is being used. > > > > > Add something like this at the top of your script. > > > > > Dim ws: Set ws = CreateObject("Wscript.Shell") > > > > > Dim username: username = > ws.ExpandEnvironmentStrings("%USERNAME%") > > > > > Then change this > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > > to this > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > > > > > I am trying to get the following login script. The problem I'm > > having > > > > is > > > > > > that I get an error message when the script tries to map the H: > > drive > > > > > > stating that the path is invalid. Thanks in advance for any help > on > > > > this. > > > > > > ********************************************************** > > > > > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > > > > > Set objFS = CreateObject("Scripting.FileSystemObject") > > > > > > if objFS.DriveExists("H:") then > > > > > > objNetwork.RemoveNetworkDrive "H:",true > > > > > > end if > > > > > > if objFS.DriveExists("P:") then > > > > > > objNetwork.RemoveNetworkDrive "P:",true > > > > > > end if > > > > > > if objFS.DriveExists("S:") then > > > > > > objNetwork.RemoveNetworkDrive "S:",true > > > > > > end if > > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > > > > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > > > > > *********************************************************
|
Tue, 29 Nov 2005 09:04:00 GMT |
|
 |
Karl #11 / 12
|
 Login Script Problems
Yes, that did it. Thanks for the help!
Quote: > right because it needs to be > objNetwork.MapNetworkDrive "H:", "\\server1\" & username > you can't put username in the quote because it will put "username" and not > the value of username > --
> need to e-mail me off list just get rid of "your fears" and > drop me a line.
> > I just displayed the value using msgbox(username) and it is being set > > correctly. However, the script is having problems with the following > line: > > objNetwork.MapNetworkDrive "H:", "\\server1\username" > > I think it may actually be looking for the share name \\server1\username > and > > not plugging in the actual user's name. Is the syntax incorrect?
> > > but if you are talking using below like the one post: > > > username = ws.ExpandEnvironmentStrings("%USERNAME%") > > > then just put after it > > > msgbox (username) > > > that will show you the value of username in a popup > > > --
> > > need to e-mail me off list just get rid of "your fears" and > > > drop me a line.
> > > > Thanks for all of your help. I think I am almost there but I am still > > > > getting an error message stating that the path is invalid even though > > the > > > > directory is there and shared out properly. For debugging purposes, > how > > > > would I display the value of %username% in this script?
> > > > > 1. Do you have a share configured for every users username on > server1 > > > > that > > > > > will run this logon script? > > > > > 2. Also, I don't believe VBScript isn't going to understand the CMD > > > > > variable in the method that is being used. > > > > > Add something like this at the top of your script. > > > > > Dim ws: Set ws = CreateObject("Wscript.Shell") > > > > > Dim username: username = > ws.ExpandEnvironmentStrings("%USERNAME%") > > > > > Then change this > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > > to this > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > > > > > I am trying to get the following login script. The problem I'm > > having > > > > is > > > > > > that I get an error message when the script tries to map the H: > > drive > > > > > > stating that the path is invalid. Thanks in advance for any help > on > > > > this. > > > > > > ********************************************************** > > > > > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > > > > > Set objFS = CreateObject("Scripting.FileSystemObject") > > > > > > if objFS.DriveExists("H:") then > > > > > > objNetwork.RemoveNetworkDrive "H:",true > > > > > > end if > > > > > > if objFS.DriveExists("P:") then > > > > > > objNetwork.RemoveNetworkDrive "P:",true > > > > > > end if > > > > > > if objFS.DriveExists("S:") then > > > > > > objNetwork.RemoveNetworkDrive "S:",true > > > > > > end if > > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > > > > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > > > > > *********************************************************
|
Tue, 29 Nov 2005 23:07:22 GMT |
|
 |
Robert Cohe #12 / 12
|
 Login Script Problems
no problem --
need to e-mail me off list just get rid of "your fears" and drop me a line.
Quote: > Yes, that did it. Thanks for the help!
> > right because it needs to be > > objNetwork.MapNetworkDrive "H:", "\\server1\" & username > > you can't put username in the quote because it will put "username" and not > > the value of username > > --
> > need to e-mail me off list just get rid of "your fears" and > > drop me a line.
> > > I just displayed the value using msgbox(username) and it is being set > > > correctly. However, the script is having problems with the following > > line: > > > objNetwork.MapNetworkDrive "H:", "\\server1\username" > > > I think it may actually be looking for the share name \\server1\username > > and > > > not plugging in the actual user's name. Is the syntax incorrect?
> > > > but if you are talking using below like the one post: > > > > username = ws.ExpandEnvironmentStrings("%USERNAME%") > > > > then just put after it > > > > msgbox (username) > > > > that will show you the value of username in a popup > > > > --
> > > > need to e-mail me off list just get rid of "your fears" and > > > > drop me a line.
> > > > > Thanks for all of your help. I think I am almost there but I am > still > > > > > getting an error message stating that the path is invalid even > though > > > the > > > > > directory is there and shared out properly. For debugging purposes, > > how > > > > > would I display the value of %username% in this script?
> > > > > > 1. Do you have a share configured for every users username on > > server1 > > > > > that > > > > > > will run this logon script? > > > > > > 2. Also, I don't believe VBScript isn't going to understand the > CMD > > > > > > variable in the method that is being used. > > > > > > Add something like this at the top of your script. > > > > > > Dim ws: Set ws = CreateObject("Wscript.Shell") > > > > > > Dim username: username = > > ws.ExpandEnvironmentStrings("%USERNAME%") > > > > > > Then change this > > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > > > to this > > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\username"
> > > > > > > I am trying to get the following login script. The problem I'm > > > having > > > > > is > > > > > > > that I get an error message when the script tries to map the H: > > > drive > > > > > > > stating that the path is invalid. Thanks in advance for any > help > > on > > > > > this. > > > > > > > ********************************************************** > > > > > > > Set objNetwork = Wscript.CreateObject("WScript.Network") > > > > > > > Set objFS = CreateObject("Scripting.FileSystemObject") > > > > > > > if objFS.DriveExists("H:") then > > > > > > > objNetwork.RemoveNetworkDrive "H:",true > > > > > > > end if > > > > > > > if objFS.DriveExists("P:") then > > > > > > > objNetwork.RemoveNetworkDrive "P:",true > > > > > > > end if > > > > > > > if objFS.DriveExists("S:") then > > > > > > > objNetwork.RemoveNetworkDrive "S:",true > > > > > > > end if > > > > > > > objNetwork.MapNetworkDrive "H:", "\\server1\%username%" > > > > > > > objNetwork.MapNetworkDrive "P:", "\\server1\apps" > > > > > > > objNetwork.MapNetworkDrive "S:", "\\server1\library" > > > > > > > *********************************************************
|
Tue, 29 Nov 2005 23:22:48 GMT |
|
|
|