TSMJ
MIS
- Nov 27, 2002
- 83
Hi
Just trying to put together a script to map a shared drive, a network printer and a default homepage. So far, I have 2 scripts, a homepage.vbs and another script doing the drive and printer. They both work perfectly when you run them separately, but when I copy the code from each into the same file I get the following message:
Line 8
Char 1
Error: Variable is undefined: 'oNet'
Code: 800A01F4
Source: MS VBScript runtime error
this is the "all in one" code:
'vb script to create homepage
Option Explicit
Dim WSHShell, RegKey
Set WSHShell = CreateObject("WScript.Shell"
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\"
WSHShell.RegWrite regkey & "Start page", "
' vb script to create network dirve "shared"
Set oNet = CreateObject("Wscript.Network"
oNet.MapNetworkDrive "H:", "\\NT1\data\data\shared"
' vb script to add printers via login script
Set WshNetwork = CreateObject("WScript.Network"
PrinterPath = "\\Fujitsu\HP_DJ_840c"
PrinterDriver = "HP DeskJet 850C"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
What haven't I done?
Thanks for any help - I'm also after some script to delete temp user profiles off the workstation after upload to the server, but 1 thing at a time, eh?
Just trying to put together a script to map a shared drive, a network printer and a default homepage. So far, I have 2 scripts, a homepage.vbs and another script doing the drive and printer. They both work perfectly when you run them separately, but when I copy the code from each into the same file I get the following message:
Line 8
Char 1
Error: Variable is undefined: 'oNet'
Code: 800A01F4
Source: MS VBScript runtime error
this is the "all in one" code:
'vb script to create homepage
Option Explicit
Dim WSHShell, RegKey
Set WSHShell = CreateObject("WScript.Shell"
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\"
WSHShell.RegWrite regkey & "Start page", "
' vb script to create network dirve "shared"
Set oNet = CreateObject("Wscript.Network"
oNet.MapNetworkDrive "H:", "\\NT1\data\data\shared"
' vb script to add printers via login script
Set WshNetwork = CreateObject("WScript.Network"
PrinterPath = "\\Fujitsu\HP_DJ_840c"
PrinterDriver = "HP DeskJet 850C"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
What haven't I done?
Thanks for any help - I'm also after some script to delete temp user profiles off the workstation after upload to the server, but 1 thing at a time, eh?