Get-WmiObject -computer $srv -Class Win32_LogicalDisk –filter "DriveType=3"

  • hello, I run this command for a remote computer :

    Get-WmiObject -computer $srv -Class Win32_LogicalDisk –filter "DriveType=3"

    this command works great, but I have a problem to run this command for instance name.

    I know that there is parmater called -namespace. but I need to tun this command for both

    computer and instance name.

    mybe, someone know any command or paramater that work for both.

    thank's, kln

  • what exactly do you mean when you specify that you need to run it on the instance. Can you provide an example of the instance name on which you want to run.

    Or else is it something like

    Instance name : ABC\XYZ

    and you want the logical drive information of all the drives present on server ABC?

    then you can do something like this :

    [System.Reflection.Assembly]::LoadWithPartialName(’Microsoft.SqlServer.SMO’) | Out-Null

    $smo = New-Object (’Microsoft.SqlServer.Management.Smo.Server’)"ABC\XYZ"

    Get-WmiObject -computer $smo.ComputerNamePhysicalNetBIOS -Class Win32_LogicalDisk –filter "DriveType=3"

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply