From: Mandy on
I am getting an error on a blank line of my script.

I'm getting an error
line: 138
char: 3
error: Network path was not found
code: 80070035
source: WSHNetwork.MapNetworkDrive

When I use my status bar in Notepad it takes me to a blank line in the
script. I've tried deleting it, commenting it out, commenting it and
several lines around it out. And this error doesn't consistently occur
on all user at all time. There's no pattern to who it happens to and
when it happens. What could be causing this? I've also checked all
the network paths and they are all working and valid.

Any input on this would be appriciated.
Thanks

Here's my code:
'*************************************************************************************************
' Declare variables
'*************************************************************************************************
Dim WshSysInfo, WshUser, WshComputer, WshGroup, WshNet
Dim WshShell

Dim fso, MyFile, lineParts
Dim strIpAddr, strMacAddr, strComputer, objWMIService
Dim ipFound
Dim SRCDATAFILE

'*************************************************************************************************
' Create system connections for data extraction from host (IP,
username, etc.)
'*************************************************************************************************
Set WshNetwork = WScript.CreateObject ("WScript.Network")
Set WshSysInfo = Createobject("ADSystemInfo")
Set WshUser = Getobject("LDAP://" & WshSysInfo.UserName)

'*********************************************************************************
'test for student membership and run survey
'*********************************************************************************

Set WshGroup =
GetObject("LDAP://CN=student,OU=student,dc=ad,dc=cob,dc=michigan-state,dc=edu")
If WshGroup.IsMember(WshUser.AdsPath) Then
Set IE = CreateObject("InternetExplorer.Application")

With IE
.left=200
.top=150
.height=700
.width=900
.menubar=0
.toolbar=0
.statusBar=0
.navigate
"http://fisher.msu.edu/computing/labsurvey/survey_check.php?userID=" &
WshUser.AdsPath
.visible=1
End With

Set IE = Nothing
End If

'*************************************************************************************************
' Test to see if computer is a member of "facstf Computers" or "student
Computers" and
' map drives, printers accordingly
'*************************************************************************************************
Set WshGroup = GetObject("LDAP://CN=facstf
Computers,OU=facstf,dc=ad,dc=cob,dc=michigan-state,dc=edu")
If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then

'*************************************************************************************************

' Force a grou policy update
'*************************************************************************************************
Set WshShell = CreateObject ("Wscript.Shell")
WshShell.Run("%systemroot%\system32\gpupdate /force")
Set WshShell = Nothing


'*************************************************************************************************
' Check for membership in "migrated" group for Novell to Windows
migration
'*************************************************************************************************
Set WshGroup =
GetObject("LDAP://CN=migrated,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-state,dc=edu")
If WshGroup.IsMember(WshUser.AdsPath) Then

'*************************************************************************************************
' Map appropriate global network drives (H: is specific to user)
'*************************************************************************************************
WshNetwork.MapNetworkDrive "G:",
"\\cobcore0.ad.cob.michigan-state.edu\group"
WshNetwork.MapNetworkDrive "H:",
"\\cobcore0.ad.cob.michigan-state.edu\" & WshNetwork.UserName & "$"
WshNetwork.MapNetworkDrive "P:",
"\\cobcore0.ad.cob.michigan-state.edu\apps"

'*************************************************************************************************
' Name global network drives (short strings for ease of
understanding)
'*************************************************************************************************
Set WshShell = CreateObject("Shell.Application")
WshShell.NameSpace("G:").Self.Name = "GROUP"
WshShell.NameSpace("H:").Self.Name = "HOME"
WshShell.NameSpace("P:").Self.Name = "APPS"

'*************************************************************************************************
' Map drives and printers for Computing Services based on Global
Security Group (csc) membership
'*************************************************************************************************
Set WshGroup =
GetObject("LDAP://CN=csc,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-state,dc=edu")
If WshGroup.IsMember(WshUser.AdsPath) Then

' Map the drives
WshNetwork.MapNetworkDrive "Q:",
"\\cobcore2.ad.cob.michigan-state.edu\tools"
WshNetwork.MapNetworkDrive "T:",
"\\broker.ad.cob.michigan-state.edu\helpdesk"

' Give them "human readable" names
Set WshShell = CreateObject("Shell.Application")
'akd q: drive corrupt again akd
'WshShell.NameSpace("Q:").Self.Name = "TOOLS"
WshShell.NameSpace("T:").Self.Name = "HELPDESK"

' Map the printers
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\mh320-csc-hp4500-color"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\mh320-csc-hp8000"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\mh320h-csc-hp8150"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\mh340a-csc-hp8150"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\mh340b-csc-hp8100"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\mh340-csc-hp8150"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\mh320p-csc-hp4000"
End If

'*************************************************************************************************
' Map drives and printers for Computing Services based on Global
Security Group (ctdlo) membership
'*************************************************************************************************
Set WshGroup =
GetObject("LDAP://CN=ctdlo,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-state,dc=edu")
If WshGroup.IsMember(WshUser.AdsPath) Then

' Map the printers
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\fi026-ctdlo-hp8500-color"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.michigan-state.edu\fi018-ctdlo-hp8150"
End If
End If
Else
Set WshGroup = GetObject("LDAP://CN=student
Computers,OU=student,dc=ad,dc=cob,dc=michigan-state,dc=edu")
If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then
'*************************************************************************************************
' This section will read in the labs.csv file and compare the IP of
the machine to the file to set
' lab and machine specifics such as printers and default printer
'*************************************************************************************************
SRCDATAFILE = "labs.csv" ' the csv file format = (ip,lab,printer
group)
strComputer = "."
ipFound = false

'*************************************************************************************************
' Force a grou policy update
'*************************************************************************************************
Set WshShell = CreateObject ("Wscript.Shell")
WshShell.Run("%systemroot%\system32\gpupdate /force")
Set WshShell = Nothing

'*************************************************************************************************
' Map appropriate global network drives (H: is specific to user)
'*************************************************************************************************
WshNetwork.MapNetworkDrive "H:",
"\\cobcore2.ad.cob.michigan-state.edu\" & WshNetwork.UserName & "$"
WshNetwork.MapNetworkDrive "P:",
"\\cobcore2.ad.cob.michigan-state.edu\apps"
WshNetwork.MapNetworkDrive "Q:",
"\\cobcore2.ad.cob.michigan-state.edu\tools"
WshNetwork.MapNetworkDrive "S:",
"\\svmsu.ad.cob.michigan-state.edu\stockval"

'*************************************************************************************************
' Name global network drives (short strings for ease of
understanding)
'*************************************************************************************************
Set WshShell = CreateObject("Shell.Application")
WshShell.NameSpace("H:").Self.Name = "HOME"
WshShell.NameSpace("P:").Self.Name = "APPS"
WshShell.NameSpace("Q:").Self.Name = "TOOLS"
WshShell.NameSpace("S:").Self.Name = "STKVAL"

'*************************************************************************************************
' Obtain local PC IP and compare to labs.csv entries
'*************************************************************************************************
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery ("Select IPAddress,
MACAddress from Win32_NetworkAdapterConfiguration")

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile(SRCDATAFILE, 1, False)

Do While MyFile.AtEndOfStream <> true
line = MyFile.readline

lineParts = split(line,",")

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
If IPConfig.IPAddress(i) <> "0.0.0.0" Then
strIpAddr = IPConfig.IPAddress(i)
strMacAddr = IPConfig.MACAddress(i)
If lineParts(0) = strIpAddr Then
ipFound = true
Exit Do
End If
End If
Next
End If
Next
Loop
MyFile.close

'*************************************************************************************************
' Map printers and set default printer based on results of IP check
against labs.csv
'*************************************************************************************************

If ipfound = TRUE Then
Select Case lineParts(1)
Case "ge208"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-1"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-2"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-3"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-4"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-5"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-color-1"

Select Case lineParts(2)
Case "1"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-1"

Case "2"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-2"

Case "3"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-3"

Case "4"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-4"

Case "5"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-ge208-5"

End Select

Case "mh005"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-1"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-2"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-3"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-4"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-5"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-6"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-color-1"

Select Case lineParts(2)
Case "1"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-1"

Case "2"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-2"

Case "3"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-3"

Case "4"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-4"

Case "5"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-5"

Case "6"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh005-6"

End Select

Case "mh010"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-1"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-2"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-3"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-4"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-5"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-6"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-7"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-8"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-9"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-color-1"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-color-2"

Select Case lineParts(2)
Case "1"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-1"

Case "2"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-2"

Case "3"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-3"

Case "4"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-4"

Case "5"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-5"

Case "6"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-6"

Case "7"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-7"

Case "8"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-8"

Case "9"
WshNetwork.SetDefaultPrinter
"\\quota.ad.cob.michigan-state.edu\ptr-mh010-9"

End Select
End Select
End If
End If

End If

From: Al Dunbar [MS-MVP] on

"Mandy" <dunn_254(a)cob.osu.edu> wrote in message
news:1140557316.809899.39590(a)z14g2000cwz.googlegroups.com...
> I am getting an error on a blank line of my script.
>
> I'm getting an error
> line: 138
> char: 3
> error: Network path was not found
> code: 80070035
> source: WSHNetwork.MapNetworkDrive
>
> When I use my status bar in Notepad it takes me to a blank line in the
> script. I've tried deleting it, commenting it out, commenting it and
> several lines around it out. And this error doesn't consistently occur
> on all user at all time. There's no pattern to who it happens to and
> when it happens. What could be causing this? I've also checked all
> the network paths and they are all working and valid.
>
> Any input on this would be appriciated.
> Thanks

Please re-post this code with each line indented so we can tell when
line-wrapping has occurred.

/Al

> Here's my code:
>
'***************************************************************************
**********************
> ' Declare variables
>
'***************************************************************************
**********************
> Dim WshSysInfo, WshUser, WshComputer, WshGroup, WshNet
> Dim WshShell
>
> Dim fso, MyFile, lineParts
> Dim strIpAddr, strMacAddr, strComputer, objWMIService
> Dim ipFound
> Dim SRCDATAFILE
>
>
'***************************************************************************
**********************
> ' Create system connections for data extraction from host (IP,
> username, etc.)
>
'***************************************************************************
**********************
> Set WshNetwork = WScript.CreateObject ("WScript.Network")
> Set WshSysInfo = Createobject("ADSystemInfo")
> Set WshUser = Getobject("LDAP://" & WshSysInfo.UserName)
>
>
'***************************************************************************
******
> 'test for student membership and run survey
>
'***************************************************************************
******
>
> Set WshGroup =
>
GetObject("LDAP://CN=student,OU=student,dc=ad,dc=cob,dc=michigan-state,dc=ed
u")
> If WshGroup.IsMember(WshUser.AdsPath) Then
> Set IE = CreateObject("InternetExplorer.Application")
>
> With IE
> .left=200
> .top=150
> .height=700
> .width=900
> .menubar=0
> .toolbar=0
> .statusBar=0
> .navigate
> "http://fisher.msu.edu/computing/labsurvey/survey_check.php?userID=" &
> WshUser.AdsPath
> .visible=1
> End With
>
> Set IE = Nothing
> End If
>
>
'***************************************************************************
**********************
> ' Test to see if computer is a member of "facstf Computers" or "student
> Computers" and
> ' map drives, printers accordingly
>
'***************************************************************************
**********************
> Set WshGroup = GetObject("LDAP://CN=facstf
> Computers,OU=facstf,dc=ad,dc=cob,dc=michigan-state,dc=edu")
> If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then
>
>
'***************************************************************************
**********************
>
> ' Force a grou policy update
>
'***************************************************************************
**********************
> Set WshShell = CreateObject ("Wscript.Shell")
> WshShell.Run("%systemroot%\system32\gpupdate /force")
> Set WshShell = Nothing
>
>
>
'***************************************************************************
**********************
> ' Check for membership in "migrated" group for Novell to Windows
> migration
>
'***************************************************************************
**********************
> Set WshGroup =
>
GetObject("LDAP://CN=migrated,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-s
tate,dc=edu")
> If WshGroup.IsMember(WshUser.AdsPath) Then
>
>
'***************************************************************************
**********************
> ' Map appropriate global network drives (H: is specific to user)
>
'***************************************************************************
**********************
> WshNetwork.MapNetworkDrive "G:",
> "\\cobcore0.ad.cob.michigan-state.edu\group"
> WshNetwork.MapNetworkDrive "H:",
> "\\cobcore0.ad.cob.michigan-state.edu\" & WshNetwork.UserName & "$"
> WshNetwork.MapNetworkDrive "P:",
> "\\cobcore0.ad.cob.michigan-state.edu\apps"
>
>
'***************************************************************************
**********************
> ' Name global network drives (short strings for ease of
> understanding)
>
'***************************************************************************
**********************
> Set WshShell = CreateObject("Shell.Application")
> WshShell.NameSpace("G:").Self.Name = "GROUP"
> WshShell.NameSpace("H:").Self.Name = "HOME"
> WshShell.NameSpace("P:").Self.Name = "APPS"
>
>
'***************************************************************************
**********************
> ' Map drives and printers for Computing Services based on Global
> Security Group (csc) membership
>
'***************************************************************************
**********************
> Set WshGroup =
>
GetObject("LDAP://CN=csc,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-state,
dc=edu")
> If WshGroup.IsMember(WshUser.AdsPath) Then
>
> ' Map the drives
> WshNetwork.MapNetworkDrive "Q:",
> "\\cobcore2.ad.cob.michigan-state.edu\tools"
> WshNetwork.MapNetworkDrive "T:",
> "\\broker.ad.cob.michigan-state.edu\helpdesk"
>
> ' Give them "human readable" names
> Set WshShell = CreateObject("Shell.Application")
> 'akd q: drive corrupt again akd
> 'WshShell.NameSpace("Q:").Self.Name = "TOOLS"
> WshShell.NameSpace("T:").Self.Name = "HELPDESK"
>
> ' Map the printers
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\mh320-csc-hp4500-color"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\mh320-csc-hp8000"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\mh320h-csc-hp8150"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\mh340a-csc-hp8150"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\mh340b-csc-hp8100"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\mh340-csc-hp8150"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\mh320p-csc-hp4000"
> End If
>
>
'***************************************************************************
**********************
> ' Map drives and printers for Computing Services based on Global
> Security Group (ctdlo) membership
>
'***************************************************************************
**********************
> Set WshGroup =
>
GetObject("LDAP://CN=ctdlo,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-stat
e,dc=edu")
> If WshGroup.IsMember(WshUser.AdsPath) Then
>
> ' Map the printers
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\fi026-ctdlo-hp8500-color"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.michigan-state.edu\fi018-ctdlo-hp8150"
> End If
> End If
> Else
> Set WshGroup = GetObject("LDAP://CN=student
> Computers,OU=student,dc=ad,dc=cob,dc=michigan-state,dc=edu")
> If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then
>
'***************************************************************************
**********************
> ' This section will read in the labs.csv file and compare the IP of
> the machine to the file to set
> ' lab and machine specifics such as printers and default printer
>
'***************************************************************************
**********************
> SRCDATAFILE = "labs.csv" ' the csv file format = (ip,lab,printer
> group)
> strComputer = "."
> ipFound = false
>
>
'***************************************************************************
**********************
> ' Force a grou policy update
>
'***************************************************************************
**********************
> Set WshShell = CreateObject ("Wscript.Shell")
> WshShell.Run("%systemroot%\system32\gpupdate /force")
> Set WshShell = Nothing
>
>
'***************************************************************************
**********************
> ' Map appropriate global network drives (H: is specific to user)
>
'***************************************************************************
**********************
> WshNetwork.MapNetworkDrive "H:",
> "\\cobcore2.ad.cob.michigan-state.edu\" & WshNetwork.UserName & "$"
> WshNetwork.MapNetworkDrive "P:",
> "\\cobcore2.ad.cob.michigan-state.edu\apps"
> WshNetwork.MapNetworkDrive "Q:",
> "\\cobcore2.ad.cob.michigan-state.edu\tools"
> WshNetwork.MapNetworkDrive "S:",
> "\\svmsu.ad.cob.michigan-state.edu\stockval"
>
>
'***************************************************************************
**********************
> ' Name global network drives (short strings for ease of
> understanding)
>
'***************************************************************************
**********************
> Set WshShell = CreateObject("Shell.Application")
> WshShell.NameSpace("H:").Self.Name = "HOME"
> WshShell.NameSpace("P:").Self.Name = "APPS"
> WshShell.NameSpace("Q:").Self.Name = "TOOLS"
> WshShell.NameSpace("S:").Self.Name = "STKVAL"
>
>
'***************************************************************************
**********************
> ' Obtain local PC IP and compare to labs.csv entries
>
'***************************************************************************
**********************
> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
> "\root\cimv2")
> Set IPConfigSet = objWMIService.ExecQuery ("Select IPAddress,
> MACAddress from Win32_NetworkAdapterConfiguration")
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set MyFile = fso.OpenTextFile(SRCDATAFILE, 1, False)
>
> Do While MyFile.AtEndOfStream <> true
> line = MyFile.readline
>
> lineParts = split(line,",")
>
> For Each IPConfig in IPConfigSet
> If Not IsNull(IPConfig.IPAddress) Then
> For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
> If IPConfig.IPAddress(i) <> "0.0.0.0" Then
> strIpAddr = IPConfig.IPAddress(i)
> strMacAddr = IPConfig.MACAddress(i)
> If lineParts(0) = strIpAddr Then
> ipFound = true
> Exit Do
> End If
> End If
> Next
> End If
> Next
> Loop
> MyFile.close
>
>
'***************************************************************************
**********************
> ' Map printers and set default printer based on results of IP check
> against labs.csv
>
'***************************************************************************
**********************
>
> If ipfound = TRUE Then
> Select Case lineParts(1)
> Case "ge208"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-1"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-2"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-3"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-4"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-5"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-color-1"
>
> Select Case lineParts(2)
> Case "1"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-1"
>
> Case "2"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-2"
>
> Case "3"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-3"
>
> Case "4"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-4"
>
> Case "5"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-5"
>
> End Select
>
> Case "mh005"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-1"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-2"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-3"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-4"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-5"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-6"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-color-1"
>
> Select Case lineParts(2)
> Case "1"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-1"
>
> Case "2"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-2"
>
> Case "3"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-3"
>
> Case "4"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-4"
>
> Case "5"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-5"
>
> Case "6"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-6"
>
> End Select
>
> Case "mh010"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-1"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-2"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-3"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-4"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-5"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-6"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-7"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-8"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-9"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-color-1"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-color-2"
>
> Select Case lineParts(2)
> Case "1"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-1"
>
> Case "2"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-2"
>
> Case "3"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-3"
>
> Case "4"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-4"
>
> Case "5"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-5"
>
> Case "6"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-6"
>
> Case "7"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-7"
>
> Case "8"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-8"
>
> Case "9"
> WshNetwork.SetDefaultPrinter
> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-9"
>
> End Select
> End Select
> End If
> End If
>
> End If
>


From: Richard Mueller on
Hi,

Difficult to read, but for me line 138 is:

WshNetwork.MapNetworkDrive "P:",
"\\cobcore2.ad.cob.michigan-state.edu\apps"

This assumes the first commented line is on line 1, and that I upwrapped the
lines correctly. I use the DOS edit command to get line numbers. I would
check that the apps share exists. I would also check adjacent shares.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"Al Dunbar [MS-MVP]" <alan-no-drub-spam(a)hotmail.com> wrote in message
news:OSOOez1NGHA.1124(a)TK2MSFTNGP10.phx.gbl...
>
> "Mandy" <dunn_254(a)cob.osu.edu> wrote in message
> news:1140557316.809899.39590(a)z14g2000cwz.googlegroups.com...
>> I am getting an error on a blank line of my script.
>>
>> I'm getting an error
>> line: 138
>> char: 3
>> error: Network path was not found
>> code: 80070035
>> source: WSHNetwork.MapNetworkDrive
>>
>> When I use my status bar in Notepad it takes me to a blank line in the
>> script. I've tried deleting it, commenting it out, commenting it and
>> several lines around it out. And this error doesn't consistently occur
>> on all user at all time. There's no pattern to who it happens to and
>> when it happens. What could be causing this? I've also checked all
>> the network paths and they are all working and valid.
>>
>> Any input on this would be appriciated.
>> Thanks
>
> Please re-post this code with each line indented so we can tell when
> line-wrapping has occurred.
>
> /Al
>
>> Here's my code:
>>
> '***************************************************************************
> **********************
>> ' Declare variables
>>
> '***************************************************************************
> **********************
>> Dim WshSysInfo, WshUser, WshComputer, WshGroup, WshNet
>> Dim WshShell
>>
>> Dim fso, MyFile, lineParts
>> Dim strIpAddr, strMacAddr, strComputer, objWMIService
>> Dim ipFound
>> Dim SRCDATAFILE
>>
>>
> '***************************************************************************
> **********************
>> ' Create system connections for data extraction from host (IP,
>> username, etc.)
>>
> '***************************************************************************
> **********************
>> Set WshNetwork = WScript.CreateObject ("WScript.Network")
>> Set WshSysInfo = Createobject("ADSystemInfo")
>> Set WshUser = Getobject("LDAP://" & WshSysInfo.UserName)
>>
>>
> '***************************************************************************
> ******
>> 'test for student membership and run survey
>>
> '***************************************************************************
> ******
>>
>> Set WshGroup =
>>
> GetObject("LDAP://CN=student,OU=student,dc=ad,dc=cob,dc=michigan-state,dc=ed
> u")
>> If WshGroup.IsMember(WshUser.AdsPath) Then
>> Set IE = CreateObject("InternetExplorer.Application")
>>
>> With IE
>> .left=200
>> .top=150
>> .height=700
>> .width=900
>> .menubar=0
>> .toolbar=0
>> .statusBar=0
>> .navigate
>> "http://fisher.msu.edu/computing/labsurvey/survey_check.php?userID=" &
>> WshUser.AdsPath
>> .visible=1
>> End With
>>
>> Set IE = Nothing
>> End If
>>
>>
> '***************************************************************************
> **********************
>> ' Test to see if computer is a member of "facstf Computers" or "student
>> Computers" and
>> ' map drives, printers accordingly
>>
> '***************************************************************************
> **********************
>> Set WshGroup = GetObject("LDAP://CN=facstf
>> Computers,OU=facstf,dc=ad,dc=cob,dc=michigan-state,dc=edu")
>> If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then
>>
>>
> '***************************************************************************
> **********************
>>
>> ' Force a grou policy update
>>
> '***************************************************************************
> **********************
>> Set WshShell = CreateObject ("Wscript.Shell")
>> WshShell.Run("%systemroot%\system32\gpupdate /force")
>> Set WshShell = Nothing
>>
>>
>>
> '***************************************************************************
> **********************
>> ' Check for membership in "migrated" group for Novell to Windows
>> migration
>>
> '***************************************************************************
> **********************
>> Set WshGroup =
>>
> GetObject("LDAP://CN=migrated,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-s
> tate,dc=edu")
>> If WshGroup.IsMember(WshUser.AdsPath) Then
>>
>>
> '***************************************************************************
> **********************
>> ' Map appropriate global network drives (H: is specific to user)
>>
> '***************************************************************************
> **********************
>> WshNetwork.MapNetworkDrive "G:",
>> "\\cobcore0.ad.cob.michigan-state.edu\group"
>> WshNetwork.MapNetworkDrive "H:",
>> "\\cobcore0.ad.cob.michigan-state.edu\" & WshNetwork.UserName & "$"
>> WshNetwork.MapNetworkDrive "P:",
>> "\\cobcore0.ad.cob.michigan-state.edu\apps"
>>
>>
> '***************************************************************************
> **********************
>> ' Name global network drives (short strings for ease of
>> understanding)
>>
> '***************************************************************************
> **********************
>> Set WshShell = CreateObject("Shell.Application")
>> WshShell.NameSpace("G:").Self.Name = "GROUP"
>> WshShell.NameSpace("H:").Self.Name = "HOME"
>> WshShell.NameSpace("P:").Self.Name = "APPS"
>>
>>
> '***************************************************************************
> **********************
>> ' Map drives and printers for Computing Services based on Global
>> Security Group (csc) membership
>>
> '***************************************************************************
> **********************
>> Set WshGroup =
>>
> GetObject("LDAP://CN=csc,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-state,
> dc=edu")
>> If WshGroup.IsMember(WshUser.AdsPath) Then
>>
>> ' Map the drives
>> WshNetwork.MapNetworkDrive "Q:",
>> "\\cobcore2.ad.cob.michigan-state.edu\tools"
>> WshNetwork.MapNetworkDrive "T:",
>> "\\broker.ad.cob.michigan-state.edu\helpdesk"
>>
>> ' Give them "human readable" names
>> Set WshShell = CreateObject("Shell.Application")
>> 'akd q: drive corrupt again akd
>> 'WshShell.NameSpace("Q:").Self.Name = "TOOLS"
>> WshShell.NameSpace("T:").Self.Name = "HELPDESK"
>>
>> ' Map the printers
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\mh320-csc-hp4500-color"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\mh320-csc-hp8000"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\mh320h-csc-hp8150"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\mh340a-csc-hp8150"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\mh340b-csc-hp8100"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\mh340-csc-hp8150"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\mh320p-csc-hp4000"
>> End If
>>
>>
> '***************************************************************************
> **********************
>> ' Map drives and printers for Computing Services based on Global
>> Security Group (ctdlo) membership
>>
> '***************************************************************************
> **********************
>> Set WshGroup =
>>
> GetObject("LDAP://CN=ctdlo,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=michigan-stat
> e,dc=edu")
>> If WshGroup.IsMember(WshUser.AdsPath) Then
>>
>> ' Map the printers
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\fi026-ctdlo-hp8500-color"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\cobcore1.ad.cob.michigan-state.edu\fi018-ctdlo-hp8150"
>> End If
>> End If
>> Else
>> Set WshGroup = GetObject("LDAP://CN=student
>> Computers,OU=student,dc=ad,dc=cob,dc=michigan-state,dc=edu")
>> If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then
>>
> '***************************************************************************
> **********************
>> ' This section will read in the labs.csv file and compare the IP of
>> the machine to the file to set
>> ' lab and machine specifics such as printers and default printer
>>
> '***************************************************************************
> **********************
>> SRCDATAFILE = "labs.csv" ' the csv file format = (ip,lab,printer
>> group)
>> strComputer = "."
>> ipFound = false
>>
>>
> '***************************************************************************
> **********************
>> ' Force a grou policy update
>>
> '***************************************************************************
> **********************
>> Set WshShell = CreateObject ("Wscript.Shell")
>> WshShell.Run("%systemroot%\system32\gpupdate /force")
>> Set WshShell = Nothing
>>
>>
> '***************************************************************************
> **********************
>> ' Map appropriate global network drives (H: is specific to user)
>>
> '***************************************************************************
> **********************
>> WshNetwork.MapNetworkDrive "H:",
>> "\\cobcore2.ad.cob.michigan-state.edu\" & WshNetwork.UserName & "$"
>> WshNetwork.MapNetworkDrive "P:",
>> "\\cobcore2.ad.cob.michigan-state.edu\apps"
>> WshNetwork.MapNetworkDrive "Q:",
>> "\\cobcore2.ad.cob.michigan-state.edu\tools"
>> WshNetwork.MapNetworkDrive "S:",
>> "\\svmsu.ad.cob.michigan-state.edu\stockval"
>>
>>
> '***************************************************************************
> **********************
>> ' Name global network drives (short strings for ease of
>> understanding)
>>
> '***************************************************************************
> **********************
>> Set WshShell = CreateObject("Shell.Application")
>> WshShell.NameSpace("H:").Self.Name = "HOME"
>> WshShell.NameSpace("P:").Self.Name = "APPS"
>> WshShell.NameSpace("Q:").Self.Name = "TOOLS"
>> WshShell.NameSpace("S:").Self.Name = "STKVAL"
>>
>>
> '***************************************************************************
> **********************
>> ' Obtain local PC IP and compare to labs.csv entries
>>
> '***************************************************************************
> **********************
>> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
>> "\root\cimv2")
>> Set IPConfigSet = objWMIService.ExecQuery ("Select IPAddress,
>> MACAddress from Win32_NetworkAdapterConfiguration")
>>
>> Set fso = CreateObject("Scripting.FileSystemObject")
>> Set MyFile = fso.OpenTextFile(SRCDATAFILE, 1, False)
>>
>> Do While MyFile.AtEndOfStream <> true
>> line = MyFile.readline
>>
>> lineParts = split(line,",")
>>
>> For Each IPConfig in IPConfigSet
>> If Not IsNull(IPConfig.IPAddress) Then
>> For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
>> If IPConfig.IPAddress(i) <> "0.0.0.0" Then
>> strIpAddr = IPConfig.IPAddress(i)
>> strMacAddr = IPConfig.MACAddress(i)
>> If lineParts(0) = strIpAddr Then
>> ipFound = true
>> Exit Do
>> End If
>> End If
>> Next
>> End If
>> Next
>> Loop
>> MyFile.close
>>
>>
> '***************************************************************************
> **********************
>> ' Map printers and set default printer based on results of IP check
>> against labs.csv
>>
> '***************************************************************************
> **********************
>>
>> If ipfound = TRUE Then
>> Select Case lineParts(1)
>> Case "ge208"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-1"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-2"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-3"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-4"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-5"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-color-1"
>>
>> Select Case lineParts(2)
>> Case "1"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-1"
>>
>> Case "2"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-2"
>>
>> Case "3"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-3"
>>
>> Case "4"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-4"
>>
>> Case "5"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-ge208-5"
>>
>> End Select
>>
>> Case "mh005"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-1"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-2"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-3"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-4"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-5"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-6"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-color-1"
>>
>> Select Case lineParts(2)
>> Case "1"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-1"
>>
>> Case "2"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-2"
>>
>> Case "3"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-3"
>>
>> Case "4"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-4"
>>
>> Case "5"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-5"
>>
>> Case "6"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh005-6"
>>
>> End Select
>>
>> Case "mh010"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-1"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-2"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-3"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-4"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-5"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-6"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-7"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-8"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-9"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-color-1"
>> WshNetwork.AddWindowsPrinterConnection
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-color-2"
>>
>> Select Case lineParts(2)
>> Case "1"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-1"
>>
>> Case "2"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-2"
>>
>> Case "3"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-3"
>>
>> Case "4"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-4"
>>
>> Case "5"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-5"
>>
>> Case "6"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-6"
>>
>> Case "7"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-7"
>>
>> Case "8"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-8"
>>
>> Case "9"
>> WshNetwork.SetDefaultPrinter
>> "\\quota.ad.cob.michigan-state.edu\ptr-mh010-9"
>>
>> End Select
>> End Select
>> End If
>> End If
>>
>> End If
>>
>
>


From: Mandy on
I am reposting the code without the tab stops to make it (hopefully)
easier to read. The offending line is now line number 137(per notepad
status bar). All the network paths are valid.

Thanks,

*Note: I changed my daomain name so to try and minimize the text
wrapping but it is still occuring somewhat.


'*************************************************************************************************
' Declare variables
'*************************************************************************************************
Dim WshSysInfo, WshUser, WshComputer, WshGroup, WshNet
Dim WshShell

Dim fso, MyFile, lineParts
Dim strIpAddr, strMacAddr, strComputer, objWMIService
Dim ipFound
Dim SRCDATAFILE

'*************************************************************************************************
' Create system connections for data extraction from host (IP,
username, etc.)
'*************************************************************************************************
Set WshNetwork = WScript.CreateObject ("WScript.Network")
Set WshSysInfo = Createobject("ADSystemInfo")
Set WshUser = Getobject("LDAP://" & WshSysInfo.UserName)

'*********************************************************************************
'test for student membership and run survey
'*********************************************************************************

Set WshGroup =
GetObject("LDAP://CN=student,OU=student,dc=ad,dc=cob,dc=m-state,dc=edu")
If WshGroup.IsMember(WshUser.AdsPath) Then
Set IE = CreateObject("InternetExplorer.Application")
With IE
..left=200
..top=150
..height=700
..width=900
..menubar=0
..toolbar=0
..statusBar=0
..navigate
"http://fisher.msu.edu/computing/labsurvey/survey_check.php?userID=" &
WshUser.AdsPath
..visible=1
End With

Set IE = Nothing
End If

'*************************************************************************************************
' Test to see if computer is a member of "facstf Computers" or "student
Computers" and
' map drives, printers accordingly
'*************************************************************************************************
Set WshGroup = GetObject("LDAP://CN=facstf
Computers,OU=facstf,dc=ad,dc=cob,dc=m-state,dc=edu")
If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then

'*************************************************************************************************
' Force a grou policy update
'*************************************************************************************************
Set WshShell = CreateObject ("Wscript.Shell")
WshShell.Run("%systemroot%\system32\gpupdate /force")
Set WshShell = Nothing
'*************************************************************************************************
' Check for membership in "migrated" group for Novell to Windows
migration
'*************************************************************************************************
Set WshGroup =
GetObject("LDAP://CN=migrated,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=m-state,dc=edu")
If WshGroup.IsMember(WshUser.AdsPath) Then

'*************************************************************************************************
' Map appropriate global network drives (H: is specific to user)
'*************************************************************************************************
WshNetwork.MapNetworkDrive "G:", "\\cobcore0.ad.cob.m-state.edu\group"
WshNetwork.MapNetworkDrive "H:", "\\cobcore0.ad.cob.m-state.edu\" &
WshNetwork.UserName & "$"
WshNetwork.MapNetworkDrive "P:", "\\cobcore0.ad.cob.m-state.edu\apps"

'*************************************************************************************************
' Name global network drives (short strings for ease of understanding)
'*************************************************************************************************
Set WshShell = CreateObject("Shell.Application")
WshShell.NameSpace("G:").Self.Name = "GROUP"
WshShell.NameSpace("H:").Self.Name = "HOME"
WshShell.NameSpace("P:").Self.Name = "APPS"

'*************************************************************************************************
' Map drives and printers for Computing Services based on Global
Security Group (csc) membership
'*************************************************************************************************
Set WshGroup =
GetObject("LDAP://CN=csc,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=m-state,dc=edu")
If WshGroup.IsMember(WshUser.AdsPath) Then

' Map the drives
WshNetwork.MapNetworkDrive "Q:", "\\cobcore2.ad.cob.m-state.edu\tools"
WshNetwork.MapNetworkDrive "T:", "\\broker.ad.cob.m-state.edu\helpdesk"

' Give them "human readable" names
Set WshShell = CreateObject("Shell.Application")
'akd q: drive corrupt again akd
'WshShell.NameSpace("Q:").Self.Name = "TOOLS"
WshShell.NameSpace("T:").Self.Name = "HELPDESK"

' Map the printers
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\mh320-csc-hp4500-color"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\mh320-csc-hp8000"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\mh320h-csc-hp8150"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\mh340a-csc-hp8150"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\mh340b-csc-hp8100"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\mh340-csc-hp8150"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\mh320p-csc-hp4000"
End If

'*************************************************************************************************
' Map drives and printers for Computing Services based on Global
Security Group (ctdlo) membership
'*************************************************************************************************
Set WshGroup =
GetObject("LDAP://CN=ctdlo,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=m-state,dc=edu")
If WshGroup.IsMember(WshUser.AdsPath) Then

' Map the printers
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\fi026-ctdlo-hp8500-color"
WshNetwork.AddWindowsPrinterConnection
"\\cobcore1.ad.cob.m-state.edu\fi018-ctdlo-hp8150"
End If
End If
Else
Set WshGroup = GetObject("LDAP://CN=student
Computers,OU=student,dc=ad,dc=cob,dc=m-state,dc=edu")
If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then
'*************************************************************************************************
' This section will read in the labs.csv file and compare the IP of the
machine to the file to set
' lab and machine specifics such as printers and default printer
'*************************************************************************************************
SRCDATAFILE = "labs.csv" ' the csv file format = (ip,lab,printer group)
strComputer = "."
ipFound = false

'*************************************************************************************************
' Force a grou policy update
'*************************************************************************************************
Set WshShell = CreateObject ("Wscript.Shell")
WshShell.Run("%systemroot%\system32\gpupdate /force")
Set WshShell = Nothing

'*************************************************************************************************
' Map appropriate global network drives (H: is specific to user)
'*************************************************************************************************
WshNetwork.MapNetworkDrive "H:", "\\cobcore2.ad.cob.m-state.edu\" &
WshNetwork.UserName & "$"
WshNetwork.MapNetworkDrive "P:", "\\cobcore2.ad.cob.m-state.edu\apps"
WshNetwork.MapNetworkDrive "Q:", "\\cobcore2.ad.cob.m-state.edu\tools"
WshNetwork.MapNetworkDrive "S:", "\\svmsu.ad.cob.m-state.edu\stockval"

'*************************************************************************************************
' Name global network drives (short strings for ease of understanding)
'*************************************************************************************************
Set WshShell = CreateObject("Shell.Application")
WshShell.NameSpace("H:").Self.Name = "HOME"
WshShell.NameSpace("P:").Self.Name = "APPS"
WshShell.NameSpace("Q:").Self.Name = "TOOLS"
WshShell.NameSpace("S:").Self.Name = "STKVAL"

'*************************************************************************************************
' Obtain local PC IP and compare to labs.csv entries
'*************************************************************************************************
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery ("Select IPAddress,
MACAddress from Win32_NetworkAdapterConfiguration")

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile(SRCDATAFILE, 1, False)

Do While MyFile.AtEndOfStream <> true
line = MyFile.readline

lineParts = split(line,",")

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
If IPConfig.IPAddress(i) <> "0.0.0.0" Then
strIpAddr = IPConfig.IPAddress(i)
strMacAddr = IPConfig.MACAddress(i)
If lineParts(0) = strIpAddr Then
ipFound = true
Exit Do
End If
End If
Next
End If
Next
Loop
MyFile.close

'*************************************************************************************************
' Map printers and set default printer based on results of IP check
against labs.csv
'*************************************************************************************************

If ipfound = TRUE Then
Select Case lineParts(1)
Case "ge208"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-ge208-1"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-ge208-2"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-ge208-3"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-ge208-4"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-ge208-5"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-ge208-color-1"
Select Case lineParts(2)
Case "1"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-1"
Case "2"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-2"

Case "3"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-3"

Case "4"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-4"

Case "5"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-5"

End Select

Case "mh005"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh005-1"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh005-2"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh005-3"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh005-4"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh005-5"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh005-6"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh005-color-1"

Select Case lineParts(2)
Case "1"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-1"

Case "2"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-2"

Case "3"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-3"

Case "4"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-4"

Case "5"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-5"

Case "6"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-6"

End Select

Case "mh010"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-1"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-2"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-3"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-4"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-5"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-6"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-7"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-8"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-9"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-color-1"
WshNetwork.AddWindowsPrinterConnection
"\\quota.ad.cob.m-state.edu\ptr-mh010-color-2"

Select Case lineParts(2)
Case "1"
WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh010-1"

From: Richard Mueller on
Hi,

Then perhaps the error is on this line:

WshNetwork.MapNetworkDrive "H:", "\\cobcore2.ad.cob.m-state.edu\" &
WshNetwork.UserName & "$"

which would imply that the share called by the username with "$" appended on
the end was not found. In any case, I would troubleshoot with a much shorter
script that isolates the problem. Perhaps:

Option Explicit
Dim WshNetwork

Set WshNetwork = WScript.CreateObject ("WScript.Network")

WshNetwork.MapNetworkDrive "H:", "\\cobcore2.ad.cob.m-state.edu\" &
WshNetwork.UserName & "$"
WshNetwork.MapNetworkDrive "P:", "\\cobcore2.ad.cob.m-state.edu\apps"
WshNetwork.MapNetworkDrive "Q:", "\\cobcore2.ad.cob.m-state.edu\tools"
WshNetwork.MapNetworkDrive "S:", "\\svmsu.ad.cob.m-state.edu\stockval"

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"Mandy" <dunn_254(a)cob.osu.edu> wrote in message
news:1140620061.827810.22310(a)g14g2000cwa.googlegroups.com...
>I am reposting the code without the tab stops to make it (hopefully)
> easier to read. The offending line is now line number 137(per notepad
> status bar). All the network paths are valid.
>
> Thanks,
>
> *Note: I changed my daomain name so to try and minimize the text
> wrapping but it is still occuring somewhat.
>
>
> '*************************************************************************************************
> ' Declare variables
> '*************************************************************************************************
> Dim WshSysInfo, WshUser, WshComputer, WshGroup, WshNet
> Dim WshShell
>
> Dim fso, MyFile, lineParts
> Dim strIpAddr, strMacAddr, strComputer, objWMIService
> Dim ipFound
> Dim SRCDATAFILE
>
> '*************************************************************************************************
> ' Create system connections for data extraction from host (IP,
> username, etc.)
> '*************************************************************************************************
> Set WshNetwork = WScript.CreateObject ("WScript.Network")
> Set WshSysInfo = Createobject("ADSystemInfo")
> Set WshUser = Getobject("LDAP://" & WshSysInfo.UserName)
>
> '*********************************************************************************
> 'test for student membership and run survey
> '*********************************************************************************
>
> Set WshGroup =
> GetObject("LDAP://CN=student,OU=student,dc=ad,dc=cob,dc=m-state,dc=edu")
> If WshGroup.IsMember(WshUser.AdsPath) Then
> Set IE = CreateObject("InternetExplorer.Application")
> With IE
> .left=200
> .top=150
> .height=700
> .width=900
> .menubar=0
> .toolbar=0
> .statusBar=0
> .navigate
> "http://fisher.msu.edu/computing/labsurvey/survey_check.php?userID=" &
> WshUser.AdsPath
> .visible=1
> End With
>
> Set IE = Nothing
> End If
>
> '*************************************************************************************************
> ' Test to see if computer is a member of "facstf Computers" or "student
> Computers" and
> ' map drives, printers accordingly
> '*************************************************************************************************
> Set WshGroup = GetObject("LDAP://CN=facstf
> Computers,OU=facstf,dc=ad,dc=cob,dc=m-state,dc=edu")
> If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then
>
> '*************************************************************************************************
> ' Force a grou policy update
> '*************************************************************************************************
> Set WshShell = CreateObject ("Wscript.Shell")
> WshShell.Run("%systemroot%\system32\gpupdate /force")
> Set WshShell = Nothing
> '*************************************************************************************************
> ' Check for membership in "migrated" group for Novell to Windows
> migration
> '*************************************************************************************************
> Set WshGroup =
> GetObject("LDAP://CN=migrated,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=m-state,dc=edu")
> If WshGroup.IsMember(WshUser.AdsPath) Then
>
> '*************************************************************************************************
> ' Map appropriate global network drives (H: is specific to user)
> '*************************************************************************************************
> WshNetwork.MapNetworkDrive "G:", "\\cobcore0.ad.cob.m-state.edu\group"
> WshNetwork.MapNetworkDrive "H:", "\\cobcore0.ad.cob.m-state.edu\" &
> WshNetwork.UserName & "$"
> WshNetwork.MapNetworkDrive "P:", "\\cobcore0.ad.cob.m-state.edu\apps"
>
> '*************************************************************************************************
> ' Name global network drives (short strings for ease of understanding)
> '*************************************************************************************************
> Set WshShell = CreateObject("Shell.Application")
> WshShell.NameSpace("G:").Self.Name = "GROUP"
> WshShell.NameSpace("H:").Self.Name = "HOME"
> WshShell.NameSpace("P:").Self.Name = "APPS"
>
> '*************************************************************************************************
> ' Map drives and printers for Computing Services based on Global
> Security Group (csc) membership
> '*************************************************************************************************
> Set WshGroup =
> GetObject("LDAP://CN=csc,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=m-state,dc=edu")
> If WshGroup.IsMember(WshUser.AdsPath) Then
>
> ' Map the drives
> WshNetwork.MapNetworkDrive "Q:", "\\cobcore2.ad.cob.m-state.edu\tools"
> WshNetwork.MapNetworkDrive "T:", "\\broker.ad.cob.m-state.edu\helpdesk"
>
> ' Give them "human readable" names
> Set WshShell = CreateObject("Shell.Application")
> 'akd q: drive corrupt again akd
> 'WshShell.NameSpace("Q:").Self.Name = "TOOLS"
> WshShell.NameSpace("T:").Self.Name = "HELPDESK"
>
> ' Map the printers
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\mh320-csc-hp4500-color"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\mh320-csc-hp8000"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\mh320h-csc-hp8150"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\mh340a-csc-hp8150"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\mh340b-csc-hp8100"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\mh340-csc-hp8150"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\mh320p-csc-hp4000"
> End If
>
> '*************************************************************************************************
> ' Map drives and printers for Computing Services based on Global
> Security Group (ctdlo) membership
> '*************************************************************************************************
> Set WshGroup =
> GetObject("LDAP://CN=ctdlo,OU=Groups,OU=facstf,dc=ad,dc=cob,dc=m-state,dc=edu")
> If WshGroup.IsMember(WshUser.AdsPath) Then
>
> ' Map the printers
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\fi026-ctdlo-hp8500-color"
> WshNetwork.AddWindowsPrinterConnection
> "\\cobcore1.ad.cob.m-state.edu\fi018-ctdlo-hp8150"
> End If
> End If
> Else
> Set WshGroup = GetObject("LDAP://CN=student
> Computers,OU=student,dc=ad,dc=cob,dc=m-state,dc=edu")
> If WshGroup.IsMember("LDAP://" & WshSysInfo.ComputerName) Then
> '*************************************************************************************************
> ' This section will read in the labs.csv file and compare the IP of the
> machine to the file to set
> ' lab and machine specifics such as printers and default printer
> '*************************************************************************************************
> SRCDATAFILE = "labs.csv" ' the csv file format = (ip,lab,printer group)
> strComputer = "."
> ipFound = false
>
> '*************************************************************************************************
> ' Force a grou policy update
> '*************************************************************************************************
> Set WshShell = CreateObject ("Wscript.Shell")
> WshShell.Run("%systemroot%\system32\gpupdate /force")
> Set WshShell = Nothing
>
> '*************************************************************************************************
> ' Map appropriate global network drives (H: is specific to user)
> '*************************************************************************************************
> WshNetwork.MapNetworkDrive "H:", "\\cobcore2.ad.cob.m-state.edu\" &
> WshNetwork.UserName & "$"
> WshNetwork.MapNetworkDrive "P:", "\\cobcore2.ad.cob.m-state.edu\apps"
> WshNetwork.MapNetworkDrive "Q:", "\\cobcore2.ad.cob.m-state.edu\tools"
> WshNetwork.MapNetworkDrive "S:", "\\svmsu.ad.cob.m-state.edu\stockval"
>
> '*************************************************************************************************
> ' Name global network drives (short strings for ease of understanding)
> '*************************************************************************************************
> Set WshShell = CreateObject("Shell.Application")
> WshShell.NameSpace("H:").Self.Name = "HOME"
> WshShell.NameSpace("P:").Self.Name = "APPS"
> WshShell.NameSpace("Q:").Self.Name = "TOOLS"
> WshShell.NameSpace("S:").Self.Name = "STKVAL"
>
> '*************************************************************************************************
> ' Obtain local PC IP and compare to labs.csv entries
> '*************************************************************************************************
> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
> "\root\cimv2")
> Set IPConfigSet = objWMIService.ExecQuery ("Select IPAddress,
> MACAddress from Win32_NetworkAdapterConfiguration")
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set MyFile = fso.OpenTextFile(SRCDATAFILE, 1, False)
>
> Do While MyFile.AtEndOfStream <> true
> line = MyFile.readline
>
> lineParts = split(line,",")
>
> For Each IPConfig in IPConfigSet
> If Not IsNull(IPConfig.IPAddress) Then
> For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
> If IPConfig.IPAddress(i) <> "0.0.0.0" Then
> strIpAddr = IPConfig.IPAddress(i)
> strMacAddr = IPConfig.MACAddress(i)
> If lineParts(0) = strIpAddr Then
> ipFound = true
> Exit Do
> End If
> End If
> Next
> End If
> Next
> Loop
> MyFile.close
>
> '*************************************************************************************************
> ' Map printers and set default printer based on results of IP check
> against labs.csv
> '*************************************************************************************************
>
> If ipfound = TRUE Then
> Select Case lineParts(1)
> Case "ge208"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-ge208-1"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-ge208-2"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-ge208-3"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-ge208-4"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-ge208-5"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-ge208-color-1"
> Select Case lineParts(2)
> Case "1"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-1"
> Case "2"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-2"
>
> Case "3"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-3"
>
> Case "4"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-4"
>
> Case "5"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-ge208-5"
>
> End Select
>
> Case "mh005"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh005-1"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh005-2"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh005-3"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh005-4"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh005-5"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh005-6"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh005-color-1"
>
> Select Case lineParts(2)
> Case "1"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-1"
>
> Case "2"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-2"
>
> Case "3"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-3"
>
> Case "4"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-4"
>
> Case "5"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-5"
>
> Case "6"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh005-6"
>
> End Select
>
> Case "mh010"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-1"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-2"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-3"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-4"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-5"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-6"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-7"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-8"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-9"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-color-1"
> WshNetwork.AddWindowsPrinterConnection
> "\\quota.ad.cob.m-state.edu\ptr-mh010-color-2"
>
> Select Case lineParts(2)
> Case "1"
> WshNetwork.SetDefaultPrinter "\\quota.ad.cob.m-state.edu\ptr-mh010-1"
>