![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Dismount drive Why is not working? It works in the VBS. $colDrives = get-wmiobject -Class Win32_Volume -namespace "root\CIMV2" -computername $strComputer | where{$_.name -eq $strDrive} foreach($objItem in $colDrives) { $objItem.Dismount($True, $True) } |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Dismount drive CodeTestDummy wrote:
to add this line: .... $objItem.Dismount($true,$true) $objItem.Put() <--Add this .... **Not tested** Marco | ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||
| Guest | Re: Dismount drive I'm not able to make this work in either PowerShell or VBScript. It appears to work if executed, but the invocation always returns a result code of 2, which means that the volume has mount points. Below is my test VBScript code. It appears that the mount point has to be removed before the volume can be dismounted. If I change the second parameter to false, the dismount succeeds - not that I can tell what that means, since it is still visible in Explorer. However, the returned result code is a 0. Possibly this is because I'm using a drive letter assigned USB drive to test this against. This is also a local test as you can tell, so it doesn't precisely mimic what you did. Here's the PowerShell version, working against drive K: get-wmiobject -Class Win32_Volume | where{$_.name -eq 'K:\'} | %{$_.Dismount($true,$false)} Here's the VBScript version: Set volumes = GetObject("winmgmts://./root/cimv2")._ ExecQuery("Select * from Win32_Volume") For Each volume in volumes if volume.Name = "K:\" Then result = volume.Dismount(true, false) WScript.Echo result end if next "CodeTestDummy" <sharp_mind.TAKETHISOUT@xxxxxx> wrote in message news:E66E0B26-83D1-4620-AF32-AB3AAF0FD1FC@xxxxxx
| ||||||||||||
My System Specs![]() | |||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Access XP data drive using Vista Ult (XP drive=slave drive only NO | John C (Go Packers!) | Vista account administration | 0 | 06-23-2008 02:38 PM |
| trouble moving files from local drive to network drive | dwsdad | Vista networking & sharing | 0 | 02-25-2008 06:32 AM |
| Vista on the C: drive but System drive is the D: drive - any way to | hinnc | Vista installation & setup | 4 | 11-15-2007 11:33 AM |
| Vista maping drive to server 2000 shared drive not recognize user/ | Sam | Vista networking & sharing | 1 | 11-02-2007 08:18 PM |
| Vista hard drive error check destroys a FAT 16 drive? Help! | Jon | Vista hardware & devices | 1 | 09-12-2007 05:19 AM |