beautypg.com

Sample powershell scripts, Adding multiple proliant servers, Adding multiple onboard administrators – HP OneView for Microsoft System Center User Manual

Page 18: Example (single command)

background image

Address: 192.168.0.101
PS C:\>

Example (single command)

PS C:\> Remove-VirtualConnectManager -address 192.168.0.101

Sample PowerShell Scripts

The following examples illustrate how PowerShell scripts can be created to add multiple devices
to the DMS.

Adding multiple ProLiant servers

This sample script uses a CSV file to add two servers to the DMS.

Sample CSV file (servers.csv)

Address,CommunityString
192.168.21.37,public
192.168.21.41,public

Sample script

$items = Import-CSV ".\servers.csv"

foreach ($item in $items)
{
"Adding " + $item.Address + " ..."
Add-ProLiantServer -Address $item.Address -CommunityString $item.CommunityString
}

Adding multiple Onboard Administrators

This sample script uses a CSV (comma separated values) file to add three Onboard Administrators
to the DMS.

Sample CSV file (enclosures.csv)

Address,Username,Password
192.168.11.34,vs,password1
192.168.11.35,Administrator,password2
192.168.11.36,vs,password1

Sample script

$items = Import-CSV ".\enclosures.csv"

foreach ($item in $items)
{
"Adding " + $item.Address + " ..."
Add-OnboardAdministrator -Address $item.Address -Username $item.Username -Password $item.Password
}

18

Using Windows PowerShell with HP Device Monitor