Solved

Powershell script / command

Posted on 2014-02-07
7
547 Views
Last Modified: 2014-02-22
Help me with the powershell Script/command  to get the details of the Drives for the list of  servers ( whether drive provided  is Physical/Storage drive).If the disk is provided from storage, then we need the detail about the disk/drive, which we will be forwarding to the Storage team to remove the disk/drive.

We normally used to logon into the server manually and from the device driver will be collecting the drive details.I am apart of build team where we would be doing the decommision of servers, as part we would be collecting the drive/disk information before unracking the servers.
0
Comment
Question by:Venugopal N
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 6

Expert Comment

by:chlebi
ID: 39842054
I did not try as I don't have computer access at the moment but something like this could work:
GET-WMIOBJECT -query "SELECT * from win32_logicaldisk" -computer computername

This shuld work as a start - at least this gives you drive list from remote machine. Then you need to filter and grab data you need.
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 39842167
I think you want to use the physical disk versus the logical disk. This way you can see more details on it

get-wmiobject win32_diskdrive -computer computername | select-object *
0
 
LVL 11

Accepted Solution

by:
Venugopal N earned 0 total points
ID: 39842248
I have worked out earlier by using Wmiobject , but most of time it gives RPC server is unavailable.I was looking for some other option.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 2

Expert Comment

by:Johan Ohlsson
ID: 39856038
Hi!

Can this be something:

1. Open Powershell than use: Enter-PSSession -ComputerName XXXXXXX      
X= Servername (If you do not can connect to the server, you need to enable PSRemote on the server you are going to connect.)

2. Invoke-Command -ComputerName XXXXXXX -ScriptBlock {Get-WmiObject -query "Select * from Win32_logicaldisk" | Format-Table $Item -auto} -credential Domain\User

3. log in

Regardes
Johan
0
 
LVL 2

Expert Comment

by:Johan Ohlsson
ID: 39864476
Hi

Try this:

Get-Content "ListofComputers.txt" | Foreach-Object {Get-WmiObject -Computername $_ -Class Win32_DiskDrive -Filter "Model like '%PowerPath%'" | select systemname,deviceid,model}

Regards
Johan
0
 
LVL 2

Expert Comment

by:Johan Ohlsson
ID: 39864538
Hi again!

Try this also:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Storage.Vds") | Out-Null
$oVdsServiceLoader = New-Object Microsoft.Storage.Vds.ServiceLoader
$oVdsService = $oVdsServiceLoader.LoadService($null)
$oVdsService.WaitForServiceReady()
$oVdsService.Reenumerate()
$cDisks = ($oVdsService.Providers |% {$_.Packs}) |% {$_.Disks}
$cPacks = $oVdsService.Providers |% {$_.Packs}

foreach($oPack in $cPacks)
{
    If($oPack.Status -eq "Online")
    {
        foreach($oDisk in $oPack.Disks)
        {
            Write-Host "$($oDisk.FriendlyName) ( $($oDisk.BusType) )"
        }


        foreach($oVolume in $oPack.Volumes)
        {
            Write-Host "`t$($oVolume.AccessPaths) ( $($oVolume.Label) )"
        }

    }
}


Regardes
Johan
0
 
LVL 11

Author Closing Comment

by:Venugopal N
ID: 39879000
WMiObject doesnt help as specified.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question