- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Microsoft
- >
- Auto detect slot number "hpssacli.exe ctrl all sho...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2016 10:02 PM
09-01-2016 10:02 PM
Hi HP Folks,
On Linux, I can do simple one liner for auto find slot number :
hpssacli ctrl all show config | sed -n '/.*rray.*in Slot/{s/.*in Slot \([^ ]\{1,\}\).*/\1/;p;}'
1
Does anyone have some scripting tips to write PowerShell to detect Smart Array Controller Slot Number?
Invoke-Expression "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl all show" # or cmd /c "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl all show" # output of Smart Array model and Slot number can be vary, something like this. Smart Array P440ar in Slot 0 (Embedded) (sn: abcdefghijklmnop) Smart Array P420i in Slot 1 (Embedded) (sn: abcdefghijklmnop) Smart Array P420i in Slot 2 (Embedded)
Can someone tell me how you do on Windows PowerShell?
I'm Happy when You're Happy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2016 12:04 AM
09-02-2016 12:04 AM
SolutionI just that is very simple by using .split()
$Ctrl = ((iex "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl all show").split())
It will turn all output into array in my $Ctrl variable:
> echo $Ctrl Smart Array P420i in Slot 0 (Embedded) (sn: 001438027D4B390)
So now I can use index [3] for Smart Array model and index [6] for Controller Slot number:
$CtrlModel = $Ctrl[3] $CtrlSlot = $Ctrl[6] echo $CtrlModel
P420i echo $CtrlSlot
0
Hope this can help someone create scripting.
I'm Happy when You're Happy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2016 01:00 AM
09-02-2016 01:00 AM
Re: Auto detect slot number "hpssacli.exe ctrl all show" by PowerShell
cmd /c "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl all show config" ### Here I use to create new volume from raw SSD in bay3,4 as RAID1 cmd /c "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl slot=$CtrlSlot create type=ld drives=1I:1:3,1I:1:4 raid=1 forced" ### I want to disable SSD SmartPath because I found it found it slower cmd /c "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl slot=$CtrlSlot array B show" cmd /c "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl slot=$CtrlSlot array B modify ssdsmartpath=disable" ### I need to re-enabled Caching after disabled SSD Spart Path cmd /c "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl slot=$CtrlSlot logicaldrive 2 show" cmd /c "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl slot=$CtrlSlot logicaldrive 2 modify caching=enable" ### Delete array B if you want to re-create cmd /c "C:\Progra~1\HP\hpssacli\bin\hpssacli.exe ctrl slot=$CtrlSlot array B delete forced" ### Rescan Disks on OS Level ### "Rescan","List Disk","List Vol" | DiskPart Please wait while DiskPart scans your configuration... DiskPart has finished scanning your configuration. DISKPART> Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 838 GB 0 B * Disk 1 Offline 1788 GB 1788 GB DISKPART> Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 C Windows NTFS Partition 203 GB Healthy Boot Volume 1 D Data NTFS Partition 634 GB Healthy Volume 2 NTFS Partition 350 MB Healthy Hidden Volume 3 FAT32 Partition 100 MB Healthy System PS C:\> Get-Disk Number Friendly Name OperationalStatus Total Size Partition Style ------ ------------- ----------------- ---------- --------------- 0 HP LOGICAL VOLUME SCSI Disk Device Online 838.33 GB GPT 1 HP LOGICAL VOLUME SCSI Disk Device Offline 1.75 TB RAW
I'm Happy when You're Happy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2016 01:01 AM
09-02-2016 01:01 AM
Re: Auto detect slot number "hpssacli.exe ctrl all show" by PowerShell
PS C:\> Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle GPT -PassThru Number Friendly Name OperationalStatus Total Size Partition Style ------ ------------- ----------------- ---------- --------------- 1 HP LOGICAL VOLUME SCSI Disk Device Offline 1.75 TB RAW PS C:\> New-Partition -DiskNumber 1 -UseMaximumSize -DriveLetter E | Get-Partition Disk Number: 1 PartitionNumber DriveLetter Offset Size Type --------------- ----------- ------ ---- ---- 2 E 135266304 1.75 TB Basic PS C:\> Get-Disk | Where Number -eq '1' Number Friendly Name OperationalStatus Total Size Partition Style ------ ------------- ----------------- ---------- --------------- 1 HP LOGICAL VOLUME SCSI Disk Device Online 1.75 TB GPT PS C:\> Format-Volume -DriveLetter E -FileSystem NTFS -NewFileSystemLabel VMData -Confirm:$false DriveLetter FileSystemLabel FileSystem DriveType HealthStatus SizeRemaining Size ----------- --------------- ---------- --------- ------------ ------------- ---- E VMData NTFS Fixed Healthy 1.75 TB 1.75 TB PS C:\> Get-Partition Disk Number: 0 PartitionNumber DriveLetter Offset Size Type --------------- ----------- ------ ---- ---- 1 1048576 350 MB Recovery 2 368050176 100 MB System 3 472907776 128 MB Reserved 4 C 607125504 203.07 GB Basic 5 D 218648018944 634.7 GB Basic Disk Number: 1 PartitionNumber DriveLetter Offset Size Type --------------- ----------- ------ ---- ---- 1 17408 128 MB Reserved 2 E 135266304 1.75 TB Basic
I'm Happy when You're Happy