Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > SBS2003 Logon Script Error

Reply
Thread Tools Display Modes

SBS2003 Logon Script Error

 
 
Justin Herbert
Guest
Posts: n/a

 
      11-18-2011
Hi all - I have a logon script that maps drives and sets up Outlook
signatures for our users that has been working perfectly for several
years for many users on many different PCs accross many different
OS's. All of a sudden I'm getting an error on just one users WinXP PC.
(The script runs fine on all other XP machines).

Windows Script Host
Script: \\RCNET\NETLOGON\XPLogSig.vbs
Line: 23
Char: 1
Error: ActiveX component can't create object:
'Scripting.FileSystemObject'
Code: 800A01AD
Source: Microsoft VBScript runtime error

it's the "Set fso = CreateObject("Scripting.FileSystemObject")" line
that seems to be causing the error.

Anyone got any ideas?

Rem Automatic Log & Signature Copy Routine - JPH -23/02/09
Const SigMasterLocation = "\\rcnet\common\Signatures"
Const SigFileName = "RC-"
Const SigFileName2 = "NOTUSED-"
Const SigFileName3 = "KMR-"
Const SigProfileLocation = "\Application Data\Microsoft\Signatures"
Const LocalLogFileName = "C:\OnLog.Log"
Const NetworkLogFileName = "\\rcnet\Logs$\NetOnLog.Log"

Set WshShell = WScript.CreateObject("WScript.Shell")
rc = WriteLogonInfo() 'Returns true if logon succeeds.
if rc = "Ok" then
WshShell.LogEvent 0, "Logon & Signature Script Completed Successfully"
else
WshShell.LogEvent 1, "Logon & Signature Script failed - " + vbcrlf +
rc
end if

Function WriteLogonInfo()
WriteLogonInfo = "Ok"
Dim WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
LogInfo = WriteLogEntry(LocalLogFileName)
If LogInfo <> "Ok" Then
WriteLogonInfo = "Local Log Failure" + vbcrlf + LogInfo
End If

LogInfo = WriteLogEntry(NetworkLogFileName)
If LogInfo <> "Ok" Then
WriteLogonInfo = "Network Log Failure" + vbcrlf + LogInfo
End If

Rem ** Check If there's a user outlook signature directory **
Set WshShell = WScript.CreateObject("WScript.Shell")
strStartMenu = WshShell.SpecialFolders("StartMenu")
strProfileDir = Left(strStartMenu,(Len(strStartMenu)-11))
strSigDir = strProfileDir + SigProfileLocation

If Not folderExists(strSigDir) Then
Set f = fso.CreateFolder(strSigDir)
End If

Rem ** If User Signature is found, Then Copy it, Else Log **
If fileExists(SigMasterLocation + "\" + SigFileName +
WshNetwork.UserName + ".htm") Then
fso.CopyFile SigMasterLocation + "\" + SigFileName +
WshNetwork.UserName + ".htm", strSigDir + "\" , True
Else
WriteLogonInfo = "Signature File Not Found" + vbcrlf + "Request
Generation Of New Signature"
End If
Rem ** If User Signature2 is found, Then Copy it, Else Log **
If fileExists(SigMasterLocation + "\" + SigFileName2 +
WshNetwork.UserName + ".htm") Then
fso.CopyFile SigMasterLocation + "\" + SigFileName2 +
WshNetwork.UserName + ".htm", strSigDir + "\" , True
Else
WriteLogonInfo = "Signature2 File Not Found" + vbcrlf + "Request
Generation Of New Signature"
End If
Rem ** Purposely flawed Signature3 code to output test data string **
If fileExists(SigMasterLocation + "\" + SigFileName3 + ".htm") Then
fso.CopyFile SigMasterLocation + "\" + SigFileName3 + ".htm",
strSigDir + "\" , True
Else
WriteLogonInfo = "Signature3 File Not Found" + vbcrlf + "Request
Generation Of New Signature"
WriteLogonInfo = "XPLogSig Tried to access: " + strSigDir + vbcrlf +
LogInfo
End If
End Function

Function fileExists(sFilePath)
Dim fso, bReturn
Set fso = CreateObject("Scripting.FileSystemObject")
bReturn = fso.FileExists(sFilePath)
fileExists = bReturn
End Function

Function folderExists(sFolderPath)
Dim fso, bReturn
Set fso = CreateObject("Scripting.FileSystemObject")
bReturn = fso.FolderExists(sFolderPath)
folderExists = bReturn
End Function

Function WriteLogEntry(LogFileName)
On Error Resume Next
WriteLogEntry = "Ok"

Dim WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(LogFileName, ForAppending, True)

If Err<>0 Then
WriteLogEntry = Err.Description
Err.clear
End If

f.Write "<LOGON>" + vbcrlf
f.Write "<DATE>"+ CStr(Now) + "</DATE>" + vbcrlf
f.Write "<COMPUTERNAME>" + WshNetwork.ComputerName + "</COMPUTERNAME>"
+ vbcrlf
f.Write "<DOMAIN>" + WshNetwork.UserDomain + "</DOMAIN>" + vbcrlf
f.Write "<USERNAME>" + WshNetwork.UserName + "</USERNAME>" + vbcrlf
f.write "strStartMenu=" + WshShell.SpecialFolders("StartMenu") +
vbcrlf
f.write "strProfileDir=" + Left(strStartMenu,(Len(strStartMenu)-11)) +
vbcrlf
f.write "strSigDir=" + strProfileDir + SigProfileLocation + vbcrlf
f.Write "</LOGON>" + vbcrlf
f.Write vbcrlf
f.Close
On Error GoTo 0
End Function

 
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
windows update does not work renzo riboli Windows Update 5 04-21-2011 07:52 AM
Discovery of PMI-Compliant Power Meter Devices Javier Càceres Windows Vista Drivers 1 09-09-2010 07:18 PM
Re: Server2003 2008 error !! Meinolf Weber [MVP-DS] Active Directory 0 11-26-2009 01:37 PM
Re: cannot syn with Windows Mobile 5.0 Chris De Herrera ActiveSync 4 09-29-2006 03:05 AM
Unresolved items: incredible! Massimo ActiveSync 9 04-18-2006 03:11 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