Venugopal N
asked on
Powershell script / command
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.
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.
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 *
get-wmiobject win32_diskdrive -computer computername | select-object *
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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
Try this:
Get-Content "ListofComputers.txt" | Foreach-Object {Get-WmiObject -Computername $_ -Class Win32_DiskDrive -Filter "Model like '%PowerPath%'" | select systemname,deviceid,model}
Regards
Johan
Hi again!
Try this also:
[System.Reflection.Assembl y]::LoadWi thPartialN ame("Micro soft.Stora ge.Vds") | Out-Null
$oVdsServiceLoader = New-Object Microsoft.Storage.Vds.Serv iceLoader
$oVdsService = $oVdsServiceLoader.LoadSer vice($null )
$oVdsService.WaitForServic eReady()
$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
Try this also:
[System.Reflection.Assembl
$oVdsServiceLoader = New-Object Microsoft.Storage.Vds.Serv
$oVdsService = $oVdsServiceLoader.LoadSer
$oVdsService.WaitForServic
$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)
}
}
}
Regardes
Johan
ASKER
WMiObject doesnt help as specified.
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.