Asked by:
Get-Member in PowerShell Studio

Question
-
I am starting to use Sapien PS Studio and trying to run a simple command:
$CIMVolC = Get-CimInstance -Namespace "root\cimv2\security\microsoftvolumeencryption" -ClassName "Win32_encryptablevolume" -Filter "DriveLetter = 'c:'"
$CIMVolC | Get-Member
That works in ISE and PS windows, however in PS Studio i am getting an error:
ERROR: Get-Member : You must specify an object for the Get-Member cmdlet.
Thanks for the help.
Monday, July 23, 2018 7:25 PM
All replies
-
The object is null. You are not getting any return value.
\_(ツ)_/
Monday, July 23, 2018 7:37 PM -
But i am getting return in the console and ISE?
This returns:
Get-WmiObject -Namespace "root\cimv2\security\microsoftvolumeencryption" -ClassName "Win32_encryptablevolume" -Filter "DriveLetter = 'c:'" | GM
But not this:
$WMIVolC = Get-WmiObject -Namespace "root\cimv2\security\microsoftvolumeencryption" -ClassName "Win32_encryptablevolume" -Filter "DriveLetter = 'c:'"
$WMIVolC | Get-Member
- Edited by Ogeccut Monday, July 23, 2018 7:52 PM
Monday, July 23, 2018 7:50 PM -
It works fin for me in PowerShell Studio. Perhaps you need to contact the vendor's support.
You also fail to say how you are trying to run this in PowerShell Studio.
\_(ツ)_/
Monday, July 23, 2018 7:53 PM -
Sorry i didnt respond sooner, I am running with Shift+F8. Is that the question?
Thanks for trying to help.
Tuesday, July 24, 2018 5:47 PM -
Sorry i didnt respond sooner, I am running with Shift+F8. Is that the question?
Thanks for trying to help.
No. Be sure all variables needed are included in the selected portion.
\_(ツ)_/
Tuesday, July 24, 2018 5:49 PM -
I get result after that line:
Get-CimInstance -Namespace "root\cimv2\security\microsoftvolumeencryption" -ClassName "Win32_encryptablevolume" -Filter "DriveLetter = 'c:'"
But when i run:
$CIMVolC=Get-CimInstance -Namespace "root\cimv2\security\microsoftvolumeencryption" -ClassName "Win32_encryptablevolume" -Filter "DriveLetter = 'c:'"
And
$CIMVolC
No result....
Same logic i get output in ISE....
Tuesday, July 24, 2018 6:01 PM -
You cannot execute one variable. You must execute the whole code block.
\_(ツ)_/
Tuesday, July 24, 2018 6:33 PM