Re: Unplug USB device
From: [MS] Scott McNairy (scotmc_at_online.microsoft.com)
Date: 04/07/04
- Next message: [MS] Scott McNairy: "Re: ExecQuery fails with 0x80041008 (WBEM_E_INVALID_PARAMETER) on W2K"
- Previous message: Ivan Brugiolo [MSFT]: "Re: Setting SeSecurityPrivilege on IWbemServices in C++"
- In reply to: Jonas Sackerud: "Re: Unplug USB device"
- Next in thread: Jonas Sackerud: "Re: Unplug USB device"
- Reply: Jonas Sackerud: "Re: Unplug USB device"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 7 Apr 2004 10:54:32 -0700
Sorry this is not possible via WMI currently, assuming that by Unplugged you
mean disabling the USB device. However if it was a share on another
computer you could delete the connection to that share.
-- [MS] Scott McNairy WMI Test Engineer This posting is provided "As Is" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm "Jonas Sackerud" <jonas.sackerud@seaflex.net> wrote in message news:eqHFXRIHEHA.1268@TK2MSFTNGP12.phx.gbl... > Please forgive my ignorance... where in the script is the USB device > unplugged? > > Thanks for the sample code Scott. I've already written the functionality I > need for replication using robocopy.exe. All I need is the code to unplug > the USB device. > > Thanks in advance - Jonas Sackerud > > "[MS] Scott McNairy" <scotmc@online.microsoft.com> skrev i meddelandet > news:4072e78d$1@news.microsoft.com... > > You can accomplish this with a script: > > > > dim bDone > > bDone = false > > > > set oQuerySink = wscript.createObject("wbemscripting.SWbemSink", "SINK_") > > set NVS = createObject("WbemScripting.SWbemNamedValueSet") > > set oContext = createObject("WbemScripting.SWbemNamedValueSet") > > > > set svc = getObject("winmgmts:root\cimv2") > > svc.Security_.AuthenticationLevel = 4 > > > > svc.ExecNotificationQueryAsync oQuerySink, "Select * From > > win32_processStopTrace where processName = 'robocopy.exe'", "WQL", 0, NVS, > > oContext > > > > do while not bDone > > wscript.sleep 1000 > > loop > > > > set oContext = nothing > > set NVS = nothing > > set oQuerySink = nothing > > > > sub SINK_OnObjectReady(obj, oContext) > > > > wscript.echo obj.ProcessName > > > > end sub > > > > sub SINK_OnCompleted(hResult, oErr, oContext) > > wscript.echo "OnCompleted for the query sink hr = 0x" & hex(hResult) > > bDone = true > > end sub > > > > -- > > [MS] Scott McNairy > > WMI Test Engineer > > This posting is provided "As Is" with no warranties, and confers no > rights. > > Use of included script samples are subject to the terms specified at > > http://www.microsoft.com/info/cpyright.htm > > > > "Jonas Sackerud" <jonas.sackerud@seaflex.net> wrote in message > > news:%23Kf2FC9GEHA.3288@TK2MSFTNGP12.phx.gbl... > > > Hoping that someone can help a novice with unplugging a USB device > > > automatically using VBScript (or any other technique for that matter). > > > > > > My issue is this: > > > > > > I'm using a USB hard drive for replicating my backup data from a Win2003 > > SBS > > > machine. Whenever a plug the hard drive to the computer the replication > > > starts using robocopy.exe from Windows Resource Kit. > > > > > > If I could manage to automatically unplug the USB hard drive when > > > replication is finished I got myself a fully automatic process. Equal > > > functionality to a tape solution but with so much more space capacity :D > > > > > > -- > > > Regards - Jonas Sackerud > > > > > > > > > > > >
- Next message: [MS] Scott McNairy: "Re: ExecQuery fails with 0x80041008 (WBEM_E_INVALID_PARAMETER) on W2K"
- Previous message: Ivan Brugiolo [MSFT]: "Re: Setting SeSecurityPrivilege on IWbemServices in C++"
- In reply to: Jonas Sackerud: "Re: Unplug USB device"
- Next in thread: Jonas Sackerud: "Re: Unplug USB device"
- Reply: Jonas Sackerud: "Re: Unplug USB device"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|