![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How do you call a method? I am trying this another way; I am writting ascrit that uses the following; Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20 arrComputers = Array(".") For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "==========================================" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root \CIMV2\Security\MicrosoftVolumeEncryption") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_EncryptableVolume", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly) So far, so good. Win32_EncryptableVolume has a method called GetEncryptionMethod(). How do I call this method and get its properties? OldDog - Please don't make me write this in PowerShell! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How do you call a method? I would first get the instances, instead of doing a query; use the following line in place of the ExecQuery statement: Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume") Then do this: dim retval, em for each volume in volumes retval = volume.GetEncryptionMethod(em) WScript.Echo em next The big issue here is that by reference parameter being passed into and back out of GetEncryptionMethod. "OldDog" <mikef2691@xxxxxx> wrote in message news:6d1f2793-ac87-48bf-af78-803d0986e0b8@xxxxxx Quote: > I am trying this another way; > > I am writting ascrit that uses the following; > > Const wbemFlagReturnImmediately = &h10 > Const wbemFlagForwardOnly = &h20 > > arrComputers = Array(".") > For Each strComputer In arrComputers > WScript.Echo > WScript.Echo "==========================================" > WScript.Echo "Computer: " & strComputer > WScript.Echo "==========================================" > > Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root > \CIMV2\Security\MicrosoftVolumeEncryption") > Set colItems = objWMIService.ExecQuery("SELECT * FROM > Win32_EncryptableVolume", "WQL", _ > wbemFlagReturnImmediately + > wbemFlagForwardOnly) > > So far, so good. > > Win32_EncryptableVolume has a method called GetEncryptionMethod(). > > How do I call this method and get its properties? > > OldDog - Please don't make me write this in PowerShell! |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How do you call a method? On May 6, 8:45*am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: Quote: > I would first get the instances, instead of doing a query; use the following > line in place of the ExecQuery statement: > > Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume") > > Then do this: > dim retval, em > > for each volume in volumes > * * retval = volume.GetEncryptionMethod(em) > * * WScript.Echo em > next > > The big issue here is that by reference parameter being passed into and back > out of GetEncryptionMethod. > > "OldDog" <mikef2...@xxxxxx> wrote in message > > news:6d1f2793-ac87-48bf-af78-803d0986e0b8@xxxxxx > > > Quote: > > I am trying this another way; Quote: > > I am writting ascrit that uses the following; Quote: > > Const wbemFlagReturnImmediately = &h10 > > Const wbemFlagForwardOnly = &h20 Quote: > > arrComputers = Array(".") > > For Each strComputer In arrComputers > > * WScript.Echo > > * WScript.Echo "==========================================" > > * WScript.Echo "Computer: " & strComputer > > * WScript.Echo "==========================================" Quote: > > * Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root > > \CIMV2\Security\MicrosoftVolumeEncryption") > > * Set colItems = objWMIService.ExecQuery("SELECT * FROM > > Win32_EncryptableVolume", "WQL", _ > > * * * * * * * * * * * * * * * * * ** * *wbemFlagReturnImmediately + > > wbemFlagForwardOnly) Quote: > > So far, so good. Quote: > > Win32_EncryptableVolume has a method called GetEncryptionMethod(). Quote: > > How do I call this method and get its properties? Quote: > > OldDog - Please don't make me write this in PowerShell!- Hide quoted text - > - Show quoted text - |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How do you call a method? On May 6, 8:45*am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: Quote: > I would first get the instances, instead of doing a query; use the following > line in place of the ExecQuery statement: > > Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume") > > Then do this: > dim retval, em > > for each volume in volumes > * * retval = volume.GetEncryptionMethod(em) > * * WScript.Echo em > next > > The big issue here is that by reference parameter being passed into and back > out of GetEncryptionMethod. > > "OldDog" <mikef2...@xxxxxx> wrote in message > > news:6d1f2793-ac87-48bf-af78-803d0986e0b8@xxxxxx > > > Quote: > > I am trying this another way; Quote: > > I am writting ascrit that uses the following; Quote: > > Const wbemFlagReturnImmediately = &h10 > > Const wbemFlagForwardOnly = &h20 Quote: > > arrComputers = Array(".") > > For Each strComputer In arrComputers > > * WScript.Echo > > * WScript.Echo "==========================================" > > * WScript.Echo "Computer: " & strComputer > > * WScript.Echo "==========================================" Quote: > > * Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root > > \CIMV2\Security\MicrosoftVolumeEncryption") > > * Set colItems = objWMIService.ExecQuery("SELECT * FROM > > Win32_EncryptableVolume", "WQL", _ > > * * * * * * * * * * * * * * * * * ** * *wbemFlagReturnImmediately + > > wbemFlagForwardOnly) Quote: > > So far, so good. Quote: > > Win32_EncryptableVolume has a method called GetEncryptionMethod(). Quote: > > How do I call this method and get its properties? Quote: > > OldDog - Please don't make me write this in PowerShell!- Hide quoted text - > - Show quoted text - dim retval, em arrComputers = Array(".") For Each strComputer In arrComputers WScript.Echo WScript.Echo "==========================================" WScript.Echo "Computer: " & strComputer WScript.Echo "==========================================" Set objWMIService = GetObject("winmgmts:\\" & strComputer _ & "\root\CIMV2\Security\MicrosoftVolumeEncryption") Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume") for each volume in volumes If volume.DriveLetter = "C:" then retval = volume.GetEncryptionMethod(em) WScript.Echo em End If Next Next <---------- End Script --------------------> Note that I was only interested in the C: drive, hence the "If volume.DriveLetter " OldDog |
My System Specs![]() |
| | #5 (permalink) |
| | Re: How do you call a method? "OldDog" <mikef2691@xxxxxx> wrote in message news:5bc08f69-11c0-4639-a57e-c281757f3b84@xxxxxx Quote: > On May 6, 8:45 am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: Quote: > Thanks, Alex. That works like a charm. Here is my script; > > dim retval, em > arrComputers = Array(".") > For Each strComputer In arrComputers > WScript.Echo > WScript.Echo "==========================================" > WScript.Echo "Computer: " & strComputer > WScript.Echo "==========================================" > > Set objWMIService = GetObject("winmgmts:\\" & strComputer _ > & "\root\CIMV2\Security\MicrosoftVolumeEncryption") > Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume") > > for each volume in volumes > If volume.DriveLetter = "C:" then > retval = volume.GetEncryptionMethod(em) > WScript.Echo em > End If > Next > Next > > <---------- End Script --------------------> > > Note that I was only interested in the C: drive, hence the "If > volume.DriveLetter " > > OldDog Finally, a real, working demo of Win32_EncryptableVolume. : ) Do GetProtectionStatus and GetConversionStatus work correctly with this as well now? I wasn't sure if the problem was using ExecQuery to get the instance references. |
My System Specs![]() |
| | #6 (permalink) |
| | Re: How do you call a method? On May 6, 11:50*am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: Quote: > "OldDog" <mikef2...@xxxxxx> wrote in message > > news:5bc08f69-11c0-4639-a57e-c281757f3b84@xxxxxx > > > > > Quote: > > On May 6, 8:45 am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: > > Thanks, Alex. That works like a charm. Here is my script; Quote: > > dim retval, em > > arrComputers = Array(".") > > For Each strComputer In arrComputers > > * WScript.Echo > > * WScript.Echo "==========================================" > > * WScript.Echo "Computer: " & strComputer > > * WScript.Echo "==========================================" Quote: > > Set objWMIService = GetObject("winmgmts:\\" & strComputer _ > > * *& "\root\CIMV2\Security\MicrosoftVolumeEncryption") > > Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume") Quote: > > for each volume in volumes > > * *If volume.DriveLetter = "C:" then > > * *retval = volume.GetEncryptionMethod(em) > > * *WScript.Echo em > > * *End If > > Next > > Next Quote: > > <---------- End Script --------------------> Quote: > > Note that I was only interested in the C: drive, hence the "If > > volume.DriveLetter " Quote: > > OldDog > Finally, a real, working demo of Win32_EncryptableVolume. : ) > > Do GetProtectionStatus and GetConversionStatus work correctly with this as > well now? I wasn't sure if the problem was using ExecQuery to get the > instance references.- Hide quoted text - > > - Show quoted text - They both come up with the numbers I am expecting. But to add to the fun, GetConversionStatus() has a property called EncryptionPercentage which would be nice to have. Any ideas there? OldDog |
My System Specs![]() |
| | #7 (permalink) |
| | Re: How do you call a method? "OldDog" <mikef2691@xxxxxx> wrote in message news:8b9b1709-ea73-49c6-ae48-99af6fa9dc11@xxxxxx Quote: > On May 6, 11:50 am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: Quote: >> "OldDog" <mikef2...@xxxxxx> wrote in message >> >> news:5bc08f69-11c0-4639-a57e-c281757f3b84@xxxxxx >> >> >> >> >> Quote: >> > On May 6, 8:45 am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: >> > Thanks, Alex. That works like a charm. Here is my script; Quote: >> > dim retval, em >> > arrComputers = Array(".") >> > For Each strComputer In arrComputers >> > WScript.Echo >> > WScript.Echo "==========================================" >> > WScript.Echo "Computer: " & strComputer >> > WScript.Echo "==========================================" Quote: >> > Set objWMIService = GetObject("winmgmts:\\" & strComputer _ >> > & "\root\CIMV2\Security\MicrosoftVolumeEncryption") >> > Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume") Quote: >> > for each volume in volumes >> > If volume.DriveLetter = "C:" then >> > retval = volume.GetEncryptionMethod(em) >> > WScript.Echo em >> > End If >> > Next >> > Next Quote: >> > <---------- End Script --------------------> Quote: >> > Note that I was only interested in the C: drive, hence the "If >> > volume.DriveLetter " Quote: >> > OldDog >> Finally, a real, working demo of Win32_EncryptableVolume. : ) >> >> Do GetProtectionStatus and GetConversionStatus work correctly with this >> as >> well now? I wasn't sure if the problem was using ExecQuery to get the >> instance references.- Hide quoted text - >> >> - Show quoted text - > > They both come up with the numbers I am expecting. > > But to add to the fun, GetConversionStatus() has a property called > EncryptionPercentage which would be nice to have. Any ideas there? > > OldDog encryptionpercent, then pass them in as parameters. dim cs, ep retval = volume.GetConversionStatus(cs, ep) WScript.Echo cs WScript.Echo ep |
My System Specs![]() |
| | #8 (permalink) |
| | Re: How do you call a method? On May 6, 6:22*pm, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: Quote: > "OldDog" <mikef2...@xxxxxx> wrote in message > > news:8b9b1709-ea73-49c6-ae48-99af6fa9dc11@xxxxxx > > > > > Quote: > > On May 6, 11:50 am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: Quote: > >> "OldDog" <mikef2...@xxxxxx> wrote in message Quote: Quote: > >>news:5bc08f69-11c0-4639-a57e-c281757f3b84@xxxxxx Quote: Quote: > >> > On May 6, 8:45 am, "Alex K. Angelopoulos" <aka(at)mvps.org> wrote: > >> > Thanks, Alex. That works like a charm. Here is my script; Quote: Quote: > >> > dim retval, em > >> > arrComputers = Array(".") > >> > For Each strComputer In arrComputers > >> > * WScript.Echo > >> > * WScript.Echo "==========================================" > >> > * WScript.Echo "Computer: " & strComputer > >> > * WScript.Echo "==========================================" Quote: Quote: > >> > Set objWMIService = GetObject("winmgmts:\\" & strComputer _ > >> > * *& "\root\CIMV2\Security\MicrosoftVolumeEncryption") > >> > Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume") Quote: Quote: > >> > for each volume in volumes > >> > * *If volume.DriveLetter = "C:" then > >> > * *retval = volume.GetEncryptionMethod(em) > >> > * *WScript.Echo em > >> > * *End If > >> > Next > >> > Next Quote: Quote: > >> > <---------- End Script --------------------> Quote: Quote: > >> > Note that I was only interested in the C: drive, hence the "If > >> > volume.DriveLetter " Quote: Quote: > >> > OldDog Quote: Quote: > >> Finally, a real, working demo of Win32_EncryptableVolume. : ) Quote: Quote: > >> Do GetProtectionStatus and GetConversionStatus work correctly with this > >> as > >> well now? I wasn't sure if the problem was using ExecQuery to get the > >> instance references.- Hide quoted text - Quote: Quote: > >> - Show quoted text - Quote: > > They both come up with the numbers I am expecting. Quote: > > But to add to the fun, GetConversionStatus() has a property called > > EncryptionPercentage which would be nice to have. Any ideas there? Quote: > > OldDog > Yep. You just define variables for both conversionstatus and > encryptionpercent, then pass them in as parameters. > > dim cs, ep > > retval = volume.GetConversionStatus(cs, ep) > WScript.Echo cs > WScript.Echo ep- Hide quoted text - > > - Show quoted text - |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Dont undertstand how this method call really works... | PowerShell | |||
| how to call a static method in a .net class from powershell? | PowerShell | |||
| you can not call a method on null-valued expression | PowerShell | |||
| You cannot call a method on a null-valued expression | PowerShell | |||