RemovePrinterConnection Method 
Author Message
 RemovePrinterConnection Method

I seem to have a problem with the RemovePrinterConnection
method of the windows scripting host.  It seems to run the
RemoveNetworkDrive method instead, and thus it tells me
the network connection doesn't exist when I give it a UNC
path to a printer.  But... if I give the
RemovePrinterConnection method a drive letter, it'll
disconnect that drive.

Is this a bug?  Does anyone have any ideas?

Thx,
Eric
.



Tue, 16 Aug 2005 05:36:53 GMT  
 RemovePrinterConnection Method
Multipost, response in .VBScript.

--
Please respond in the newsgroup so everyone may benefit.
 http://dev.remotenetworktechnology.com
(email requests for support contract information welcomed)
 ----------
 Subscribe to Microsoft's Security Bulletins:
 http://www.microsoft.com/technet/security/bulletin/notify.asp


Quote:
> I seem to have a problem with the RemovePrinterConnection
> method of the windows scripting host.  It seems to run the
> RemoveNetworkDrive method instead, and thus it tells me
> the network connection doesn't exist when I give it a UNC
> path to a printer.  But... if I give the
> RemovePrinterConnection method a drive letter, it'll
> disconnect that drive.

> Is this a bug?  Does anyone have any ideas?

> Thx,
> Eric
> .



Tue, 16 Aug 2005 05:53:15 GMT  
 RemovePrinterConnection Method
Use the following code to check your WSH version.  You have to be on WSH 5.6
to use RemovePrinterConnection.

On Error Resume Next
WScript.Echo "WSH Version: " & WScript.Version
Wscript.Echo "VBScript Version: " & ScriptEngineMajorVersion _
    & "." & ScriptEngineMinorVersion
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer _
        & "\root\cimv2")
Set colWMISettings = objWMIService.ExecQuery _
    ("Select * from Win32_WMISetting")
For Each objWMISetting in colWMISettings
    Wscript.Echo "WMI Version: " & objWMISetting.BuildVersion
Next
Set objShell = CreateObject("WScript.Shell")
strAdsiVersion = _
objShell.RegRead("HKLM\SOFTWARE\Microsoft\Active Setup\Installed
Components\{E92B03AB-B707-11d2-9CBD-0000F87A369E}\Version")
If strAdsiVersion = vbEmpty Then
    strAdsiVersion =
objShell.RegRead("HKLM\SOFTWARE\Microsoft\ADs\Providers\LDAP\")
    If strAdsiVersion = vbEmpty Then
        strAdsiVersion = "ADSI is not installed."
    Else
        strAdsiVersion = "2.0"
    End If
End If
WScript.Echo "ADSI Version: " & strAdsiVersion

If you are not on 5.6 you can download the update at:
http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample...
l=/msdn-files/027/001/733/msdncompositedoc.xml

Good luck

Charles



Quote:
> Multipost, response in .vbscript.

> --
> Please respond in the newsgroup so everyone may benefit.
>  http://dev.remotenetworktechnology.com
> (email requests for support contract information welcomed)
>  ----------
>  Subscribe to Microsoft's Security Bulletins:
>  http://www.microsoft.com/technet/security/bulletin/notify.asp



> > I seem to have a problem with the RemovePrinterConnection
> > method of the windows scripting host.  It seems to run the
> > RemoveNetworkDrive method instead, and thus it tells me
> > the network connection doesn't exist when I give it a UNC
> > path to a printer.  But... if I give the
> > RemovePrinterConnection method a drive letter, it'll
> > disconnect that drive.

> > Is this a bug?  Does anyone have any ideas?

> > Thx,
> > Eric
> > .



Tue, 16 Aug 2005 07:32:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help with RemovePrinterConnection method

2. RemovePrinterConnection method

3. Question about the RemovePrinterConnection Method.

4. RemovePrinterConnection not working

5. RemovePrinterConnection

6. removeprinterconnection

7. RemovePrinterConnection problem

8. RemovePrinterConnection does not work

9. "RemovePrinterConnection" Not Removing All Printers

10. RemovePrinterConnection failing and RemoveNetwork drive reported instead

11. RemovePrinterConnection

12. RemovePrinterConnection

 

 
Powered by phpBB® Forum Software