VBScript

C

chuck walsh

I am trying to run a VB Script to map a network printer.
But when I try to execute it, I get an error message
saying "The remote server machine does not exist or is
unavailable." It points to the strUserDN line below. I'm
not sure why I am getting this message. Any help would be
appreciated.

Option Explicit

Dim objNetwork, objSysInfo, strUserDN
Dim objGroupList, objUser, objFSO
Dim strComputerDN, objComputer

Set objNetwork = CreateObject("Wscript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.userName
strComputerDN = objSysInfo.computerName
'wscript.Echo
' Bind to the user and computer objects with the LDAP
provider.
Set objUser = GetObject("LDAP://" & strUserDN)
Set objComputer = GetObject("LDAP://" & strComputerDN)

' Add a network printer if the user is a member of the
group.
' Make this printer the default.
If IsMember(objUser, "ptest") Then
objNetwork.AddWindowsPrinterConnection "\\server1\PPROG"
objNetwork.SetDefaultPrinter "\\server1\PPROG"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top