Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > Logon Script issue

Reply
Thread Tools Display Modes

Logon Script issue

 
 
Dale K
Guest
Posts: n/a

 
      07-24-2007
Good Morning,

I am executing this logon script via a gpo. It works fine with xp but not
with vista. I will work with vista if I execute it manually but not in the
gpo. I know it is executing and in fact I know it executes the lines that
tell it to map the drives but they drives never map. No errors nothing in
the log files. Can anyone help?

Here is the file (login.vbs)

'--------------------------------------------------------------------------------------------------
'Login.vbs - Default login script for xyz.local (OU=
'
'
' Date Author Comment
' ---- ------ -------
' 06/20/2007 Dale Kalsow Created from MapDrives.vbs and LoginNew.ba
'--------------------------------------------------------------------------------------------------
Option Explicit

Dim Verbose
Verbose = 0

on error resume next

Dim wshNetwork, wshShell, wshEnv
Dim strUserName
Dim Filesys, Path

Set wshNetwork = WScript.CreateObject("Wscript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshEnv = WshShell.Environment("SYSTEM")
strUserName=WshNetwork.UserName
Set Filesys = CreateObject("Scripting.FileSystemObject")
Path = filesys.GetAbsolutePathName("C:\eEntrprs\")

'--------------------- Hard Coded Variables
--------------------------------------------------------

Dim ServerName1, ServerName2, ServerName3
ServerName1="\\dbi01"
ServerName2="\\dsql"
ServerName3="\\frirst"

'--------------------- End Hard Coded Variables
-----------------------------------------------------


'--------------------- Map Network Drives
-----------------------------------------------------------

If FileSys.DriveExists("F:") = False Then
'WshNetwork.RemoveNetworkDrive "F:" - Disconnects the current network drive.
WshNetwork.MapNetworkDrive "F:", ServerName1 & "\GreatPlains", false
End if

If strUserName="JSmith" Then
If FileSys.DriveExists("H:") = False Then
WshNetwork.MapNetworkDrive "H:", ServerName2 & "\dynsql_c", false
End if
If FileSys.DriveExists("L:") = False Then
WshNetwork.MapNetworkDrive "L:", ServerName1 & "\home\" & strUserName, false
End if
Else
If FileSys.DriveExists("H:") = False Then
WshNetwork.MapNetworkDrive "H:", ServerName1 & "\home\" & strUserName, false
End if
End if

If FileSys.DriveExists("I:") = False Then
WshNetwork.MapNetworkDrive "I:", ServerName1 & "\DShare", false
End if
If FileSys.DriveExists("J:") = False Then
WshNetwork.MapNetworkDrive "J:", ServerName1 & "\PShare", false
End if
'WshNetwork.MapNetworkDrive "K:", ServerName1 & "\greatplains\APPS\MSMAIL",
false


'--------------------- End Map Network Drives
--------------------------------------------------------

'--------------------- Sync PC with Server Time
------------------------------------------------------

WshShell.run "NET TIME \\dbi01 /set /y"


'--------------------- End Sync PC with Server Time
--------------------------------------------------

'--------------------- Copy GreatPlains Files
--------------------------------------------------------

If Filesys.FolderExists(Path) Then
Path = filesys.GetAbsolutePathName("C:\eEntrprs\locrpt.di c")
If Not Filesys.FileExists(Path) then
Filesys.CopyFile "\\dbims01\GreatPlains\Login\Forms.dic", "C:\eEntrprs\",
TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\Login\Dynamics.set",
"C:\eEntrprs\", TRUE
Filesys.CopyFile
"\\dbims01\GreatPlains\Dynsql_Reports\Custom\repor ts.dic", "C:\eEntrprs\",
TRUE
Filesys.CopyFile
"\\dbims01\GreatPlains\Dynsql_Reports\Custom\hrpfr ms.dic", "C:\eEntrprs\",
TRUE
Filesys.CopyFile
"\\dbims01\GreatPlains\Dynsql_Reports\Custom\hrprp ts.dic", "C:\eEntrprs\",
TRUE
Filesys.CopyFile
"\\dbims01\GreatPlains\Dynsql_Reports\Custom\iconr pts.dic", "C:\eEntrprs\",
TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\Dynsql_Reports\Custom\locrp t.dic",
"C:\eEntrprs\", TRUE
end if


Path = filesys.GetAbsolutePathName("C:\eEntrprs\55g13.txt ")
If Not Filesys.FileExists(Path) Then
Filesys.CopyFile "\\dbims01\GreatPlains\login\dex.dic", "C:\eEntrprs\", TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\dynamics.exe",
"C:\eEntrprs\", TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\55g13.txt", "C:\eEntrprs\",
TRUE
end if

Path = filesys.GetAbsolutePathName("c:\eentrprs\55g26.txt ")
If Not Filesys.FileExists(Path) Then
Filesys.CopyFile "\\dbims01\GreatPlains\login\dyn55g26.cnk",
"C:\eEntrprs\", TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\55g26.txt", "C:\eEntrprs\",
TRUE
end if

Path = filesys.GetAbsolutePathName("C:\eEntrprs\20000508. 5524")
If Not Filesys.FileExists(Path) Then
Filesys.CopyFile "\\dbims01\GreatPlains\login\iconmfg.cnk",
"C:\eEntrprs\", TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\linker.dll", "C:\eEntrprs\",
TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\20000508.5524",
"C:\eEntrprs\", TRUE
end if

Path = filesys.GetAbsolutePathName("c:\eentrprs\20060814. set")
If Not Filesys.FileExists(Path) Then
Filesys.CopyFile "\\dbims01\GreatPlains\login\dynamics.set",
"C:\eEntrprs\", TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\20060814.set",
"C:\eEntrprs\", TRUE
end if

Path = filesys.GetAbsolutePathName("c:\eentrprs\20000508. dex")
If Not Filesys.FileExists(Path) Then
Filesys.CopyFile "\\dbims01\GreatPlains\login\dex.ini", "C:\eEntrprs\", TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\20000508.dex",
"C:\eEntrprs\", TRUE
end if

Path = filesys.GetAbsolutePathName("c:\eentrprs\20000207. loc")
If Not Filesys.FileExists(Path) Then
Filesys.CopyFile "\\dbims01\GreatPlains\login\loc550.cnk", "C:\eEntrprs\",
TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\20000207.loc",
"C:\eEntrprs\", TRUE
End if

Path = filesys.GetAbsolutePathName("c:\eentrprs\20041029. dic")
If Not Filesys.FileExists(Path) Then
'Filesys.CopyFile "\\dbims01\GreatPlains\login\forms.dic", "C:\eEntrprs\",
TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\iconfrms.dic",
"C:\eEntrprs\", TRUE
'Filesys.CopyFile "\\dbims01\GreatPlains\login\hrpfrms.dic",
"C:\eEntrprs\", TRUE
'Filesys.CopyFile "\\dbims01\GreatPlains\login\locform.dic",
"C:\eEntrprs\", TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\20041029.dic",
"C:\eEntrprs\", TRUE
End if

Filesys.CopyFile "\\dbims01\GreatPlains\login\iconmfg.vba", "C:\eEntrprs\",
TRUE
Filesys.CopyFile "\\dbims01\GreatPlains\login\dynamics.vba",
"C:\eEntrprs\", TRUE

Path = filesys.GetAbsolutePathName("c:\Windows\vbrt60.txt ")
If Not Filesys.FileExists(Path) Then
WshShell.Run "\\dbims01\greatplains\login\vbrun60sp3.exe /q", 2, false
Filesys.CopyFile "\\dbims01\GreatPlains\login\vbrt60.txt", "c:\Windows\",
TRUE
End if
End if

'--------------------- End Copy GreatPlains Files
----------------------------------------------------


'WShShell.PopUp "Your drives have completed mapping"

'---------------------------- Clean Up
---------------------------------------------------------------

Set wshNetwork = Nothing
Set wshShell = Nothing
Set wshEnv = Nothing
Set strUserName = Nothing
Set Filesys = Nothing
Set Path = Nothing

'-------------------------- End Clean Up
-------------------------------------------------------------


Thanks!

Dale

 
Reply With Quote
 
 
 
 
Jon
Guest
Posts: n/a

 
      07-24-2007
It's a known issue with mapping drives, and is due to the fact that your
login scripts are running with elevated privileges.
The drives have actually mapped, but they're only visible in Computer, if
you open up an elevated explorer shell. To have them appear normally your
script would need to run non-elevated.

I don't know if there's a hotfix available for it yet (you could check), but
I'm pretty sure MS are aware of it.

--
Jon


"Dale K" <> wrote in message
news:12A99622-A7B9-47A2-958A-...
> Good Morning,
>
> I am executing this logon script via a gpo. It works fine with xp but not
> with vista. I will work with vista if I execute it manually but not in
> the
> gpo. I know it is executing and in fact I know it executes the lines that
> tell it to map the drives but they drives never map. No errors nothing in
> the log files. Can anyone help?
>
> Here is the file (login.vbs)
>
> '--------------------------------------------------------------------------------------------------
> 'Login.vbs - Default login script for xyz.local (OU=
> '
> '
> ' Date Author Comment
> ' ---- ------ -------
> ' 06/20/2007 Dale Kalsow Created from MapDrives.vbs and LoginNew.bat
> '--------------------------------------------------------------------------------------------------
> Option Explicit
>
> Dim Verbose
> Verbose = 0
>
> on error resume next
>
> Dim wshNetwork, wshShell, wshEnv
> Dim strUserName
> Dim Filesys, Path
>
> Set wshNetwork = WScript.CreateObject("Wscript.Network")
> Set WshShell = WScript.CreateObject("WScript.Shell")
> Set WshEnv = WshShell.Environment("SYSTEM")
> strUserName=WshNetwork.UserName
> Set Filesys = CreateObject("Scripting.FileSystemObject")
> Path = filesys.GetAbsolutePathName("C:\eEntrprs\")
>
> '--------------------- Hard Coded Variables
> --------------------------------------------------------
>
> Dim ServerName1, ServerName2, ServerName3
> ServerName1="\\dbi01"
> ServerName2="\\dsql"
> ServerName3="\\frirst"
>
> '--------------------- End Hard Coded Variables
> -----------------------------------------------------
>
>
> '--------------------- Map Network Drives
> -----------------------------------------------------------
>
> If FileSys.DriveExists("F:") = False Then
> 'WshNetwork.RemoveNetworkDrive "F:" - Disconnects the current network
> drive.
> WshNetwork.MapNetworkDrive "F:", ServerName1 & "\GreatPlains", false
> End if
>
> If strUserName="JSmith" Then
> If FileSys.DriveExists("H:") = False Then
> WshNetwork.MapNetworkDrive "H:", ServerName2 & "\dynsql_c", false
> End if
> If FileSys.DriveExists("L:") = False Then
> WshNetwork.MapNetworkDrive "L:", ServerName1 & "\home\" & strUserName,
> false
> End if
> Else
> If FileSys.DriveExists("H:") = False Then
> WshNetwork.MapNetworkDrive "H:", ServerName1 & "\home\" & strUserName,
> false
> End if
> End if
>
> If FileSys.DriveExists("I:") = False Then
> WshNetwork.MapNetworkDrive "I:", ServerName1 & "\DShare", false
> End if
> If FileSys.DriveExists("J:") = False Then
> WshNetwork.MapNetworkDrive "J:", ServerName1 & "\PShare", false
> End if
> 'WshNetwork.MapNetworkDrive "K:", ServerName1 &
> "\greatplains\APPS\MSMAIL",
> false
>
>
> '--------------------- End Map Network Drives
> --------------------------------------------------------
>
> '--------------------- Sync PC with Server Time
> ------------------------------------------------------
>
> WshShell.run "NET TIME \\dbi01 /set /y"
>
>
> '--------------------- End Sync PC with Server Time
> --------------------------------------------------
>
> '--------------------- Copy GreatPlains Files
> --------------------------------------------------------
>
> If Filesys.FolderExists(Path) Then
> Path = filesys.GetAbsolutePathName("C:\eEntrprs\locrpt.di c")
> If Not Filesys.FileExists(Path) then
> Filesys.CopyFile "\\dbims01\GreatPlains\Login\Forms.dic", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\Login\Dynamics.set",
> "C:\eEntrprs\", TRUE
> Filesys.CopyFile
> "\\dbims01\GreatPlains\Dynsql_Reports\Custom\repor ts.dic", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile
> "\\dbims01\GreatPlains\Dynsql_Reports\Custom\hrpfr ms.dic", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile
> "\\dbims01\GreatPlains\Dynsql_Reports\Custom\hrprp ts.dic", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile
> "\\dbims01\GreatPlains\Dynsql_Reports\Custom\iconr pts.dic",
> "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\Dynsql_Reports\Custom\locrp t.dic",
> "C:\eEntrprs\", TRUE
> end if
>
>
> Path = filesys.GetAbsolutePathName("C:\eEntrprs\55g13.txt ")
> If Not Filesys.FileExists(Path) Then
> Filesys.CopyFile "\\dbims01\GreatPlains\login\dex.dic", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\dynamics.exe",
> "C:\eEntrprs\", TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\55g13.txt", "C:\eEntrprs\",
> TRUE
> end if
>
> Path = filesys.GetAbsolutePathName("c:\eentrprs\55g26.txt ")
> If Not Filesys.FileExists(Path) Then
> Filesys.CopyFile "\\dbims01\GreatPlains\login\dyn55g26.cnk",
> "C:\eEntrprs\", TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\55g26.txt", "C:\eEntrprs\",
> TRUE
> end if
>
> Path = filesys.GetAbsolutePathName("C:\eEntrprs\20000508. 5524")
> If Not Filesys.FileExists(Path) Then
> Filesys.CopyFile "\\dbims01\GreatPlains\login\iconmfg.cnk",
> "C:\eEntrprs\", TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\linker.dll", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\20000508.5524",
> "C:\eEntrprs\", TRUE
> end if
>
> Path = filesys.GetAbsolutePathName("c:\eentrprs\20060814. set")
> If Not Filesys.FileExists(Path) Then
> Filesys.CopyFile "\\dbims01\GreatPlains\login\dynamics.set",
> "C:\eEntrprs\", TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\20060814.set",
> "C:\eEntrprs\", TRUE
> end if
>
> Path = filesys.GetAbsolutePathName("c:\eentrprs\20000508. dex")
> If Not Filesys.FileExists(Path) Then
> Filesys.CopyFile "\\dbims01\GreatPlains\login\dex.ini", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\20000508.dex",
> "C:\eEntrprs\", TRUE
> end if
>
> Path = filesys.GetAbsolutePathName("c:\eentrprs\20000207. loc")
> If Not Filesys.FileExists(Path) Then
> Filesys.CopyFile "\\dbims01\GreatPlains\login\loc550.cnk", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\20000207.loc",
> "C:\eEntrprs\", TRUE
> End if
>
> Path = filesys.GetAbsolutePathName("c:\eentrprs\20041029. dic")
> If Not Filesys.FileExists(Path) Then
> 'Filesys.CopyFile "\\dbims01\GreatPlains\login\forms.dic", "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\iconfrms.dic",
> "C:\eEntrprs\", TRUE
> 'Filesys.CopyFile "\\dbims01\GreatPlains\login\hrpfrms.dic",
> "C:\eEntrprs\", TRUE
> 'Filesys.CopyFile "\\dbims01\GreatPlains\login\locform.dic",
> "C:\eEntrprs\", TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\20041029.dic",
> "C:\eEntrprs\", TRUE
> End if
>
> Filesys.CopyFile "\\dbims01\GreatPlains\login\iconmfg.vba",
> "C:\eEntrprs\",
> TRUE
> Filesys.CopyFile "\\dbims01\GreatPlains\login\dynamics.vba",
> "C:\eEntrprs\", TRUE
>
> Path = filesys.GetAbsolutePathName("c:\Windows\vbrt60.txt ")
> If Not Filesys.FileExists(Path) Then
> WshShell.Run "\\dbims01\greatplains\login\vbrun60sp3.exe /q", 2, false
> Filesys.CopyFile "\\dbims01\GreatPlains\login\vbrt60.txt", "c:\Windows\",
> TRUE
> End if
> End if
>
> '--------------------- End Copy GreatPlains Files
> ----------------------------------------------------
>
>
> 'WShShell.PopUp "Your drives have completed mapping"
>
> '---------------------------- Clean Up
> ---------------------------------------------------------------
>
> Set wshNetwork = Nothing
> Set wshShell = Nothing
> Set wshEnv = Nothing
> Set strUserName = Nothing
> Set Filesys = Nothing
> Set Path = Nothing
>
> '-------------------------- End Clean Up
> -------------------------------------------------------------
>
>
> Thanks!
>
> Dale
>


 
Reply With Quote
 
ThePro
Guest
Posts: n/a

 
      07-24-2007
"Dale K" <> wrote:
> Good Morning,
>
> I am executing this logon script via a gpo. It works fine with xp but not
> with vista. I will work with vista if I execute it manually but not in
> the
> gpo. I know it is executing and in fact I know it executes the lines that
> tell it to map the drives but they drives never map. No errors nothing in
> the log files. Can anyone help?


BTW I map drives via GPO with a regular batch file (.cmd file) and it works
great in Vista.

ThePro

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logon script problem Jonny Bergdahl Windows Vista Networking 4 05-06-2009 02:59 PM
Logon script not running? Murphy Wong Windows Vista General Discussion 2 08-25-2007 11:44 AM
Logon script is not visible טל ז Windows Vista Networking 0 08-09-2007 11:18 AM
Logon Script randyh@newsgroups.nospam Windows Vista General Discussion 0 11-22-2006 01:46 PM
Unable to run vbs logon script Wajinga Windows Vista Administration 1 06-13-2006 09:01 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59