cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
11323
Views
9
Helpful
3
Comments
sumbr
Level 4
Level 4

This script gets a detailed inventory report for the UCS domains.

Comments
menzies456
Level 1
Level 1

Hi,

I am new to power shell as of today. I've managed to run this script and it is just what I wanted.

Only thing is each time I run it I have to put in the IP of UCS and the username.

I have tried manipulating the variables but I'm obviously doing it wrong.

I'm just using UCSPE.

<#

UcsInventoryCollection.ps1 Version=1.0

Execution string:  .\UcsInventoryCollection.ps1 -ucsm 192.168.148.130 -credential  <psCredential>

                  

Example:

$user = "cliuser"

$password = "cliuser" | ConvertTo-SecureString -AsPlainText -Force

$cred = New-Object System.Management.Automation.PSCredential($user,$password)

.\UcsInventoryCollection.ps1 -ucsm 192.168.48.130 -credential $cred

This script generates UCS inventory report for given UCS(s) .

#>

Any help is appreciated.

Sam

sumbr
Level 4
Level 4

Hi Sam,

f you want to hardcode IP of your UCS domains instead of specifying every time you can follow below steps.

1. Remove the lines 20,21 and 22

[parameter(Mandatory=${true})]

  [ValidateNotNullOrEmpty()]

  [string]${ucsm},

2. Modify line 408 [array]$ucsArray = $ucsm.split(",") |%{$_.Trim()} as mentioned below

[array]$ucsArray = ("192.168.48.130")

if you want to specify multiple ucs domains you can add them to the array by specifying in a comma separated way.

Similarly for credentials you can remove the lines 24 and 25

[parameter(Mandatory=${true})]

  [System.Management.Automation.PSCredential]${credential},

and define the variable $credential as your are doing outside of the script.

$user = "cliuser"

$password = "cliuser" | ConvertTo-SecureString -AsPlainText -Force

$credential = New-Object System.Management.Automation.PSCredential($user,$password)

Hope this helps. Let me know if you need more information.

Thanks,

Sumanth B R

menzies456
Level 1
Level 1

I thought that I was doing something wrong.

That is fabulous I will now use this.

Many Thanks

Sam

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links