Skip to content

Instantly share code, notes, and snippets.

View ChrisLynchHPE's full-sized avatar

Chris Lynch ChrisLynchHPE

View GitHub Profile
"Installed HPE OneView libraries: "
Get-Module -ListAvailable HPEOneView*
"PowerShell version : " + $PSVersionTable.PSVersion
"OS version : " + [System.Environment]::OSVersion.VersionString
$NetworksWithAssociations = @()
# Get associated newtorks with server profiles
$NetworksWithAssociations += (Send-OVRequest -Uri '/rest/index/associations?name=SERVER_PROFILE_TEMPLATE_TO_NETWORK').members
# Get associated newtorks with server profile templates
$NetworksWithAssociations += (Send-OVRequest -Uri '/rest/index/associations?name=server_profiles_to_networks').members
# Get list of networks associated with network sets
$NetworksWithAssociations += (Send-OVRequest -Uri '/rest/index/associations?name=NETWORKSET_TO_NETWORK').members
Add-Type @"
namespace System.Security.Cryptography.X509Certificates {
public enum X509KeySpecFlags {
None = 0,
AT_KEYEXCHANGE = 1,
AT_SIGNATURE = 2
}
}
"@
function Convert-PemToPfx {
$tasks = @()
# Get server profiles Apollo XL290 Gen9 server hardware type to then filter
$ServerProfiles = Get-OVServerProfile -InputObject (Get-OVServerHardwareType -Name "HPE ProLiant XL450 Gen9" -ErrorAction Stop)
ForEach ($serverProfile in $ServerProfiles)
{
# Change the profile Baseline property to "Managed Manually"
$serverProfile.firmware.manageFirmware = $false
# Get the SHT of the server hardware
$BL460cGen9SHT = Get-OVServerHardwareType -Name 'BL460c Gen9 1'
# Get the EG
$EnclosureGroup = Get-OVEnclosureGroup -Name $DCSDefaultEGName
# Create our profile Ethernet connections
$ServerProfileConnection1NetObject = Get-OVNetwork -Name $ServerProfileConnection1NetName -ErrorAction Stop
$ProfileConnection1 = New-OVServerProfileConnection -ConnectionID 1 -Name "$ServerProfileConnection1NetName Connection" -Network $ServerProfileConnection1NetObject
$ServerProfileConnection2NetObject = Get-OVNetwork -Name $ServerProfileConnection2NetName -ErrorAction Stop
@ChrisLynchHPE
ChrisLynchHPE / Update-LocaliLOAdminCredentials.ps1
Last active January 17, 2020 17:10
This script updates the administrator account password using HPE OneView Server Profile Template, then updates the associated Server Profile resources.
# Prompt admin for updated password value
Do
{
# Prompt for new password
$Password = Read-Host "Password" -AsSecureString
# Ask for it again
$Password2 = Read-Host "Confirm password" -AsSecureString

Keybase proof

I hereby claim:

  • I am chrislynchhpe on github.
  • I am chrislynchhpe (https://keybase.io/chrislynchhpe) on keybase.
  • I have a public key ASAie7DtPMQOFmbZbRISDgTvk5QOYACjadHUcEobpSGVoQo

To claim this, I am signing this object:

$ServerName = "ReplaceMe"
$Server = Get-HPOVServer -Name $ServerName
$Credential = Get-Credential
$_InputObject = $Server.PSObject.Copy()
$_uri = $_InputObject.uri + "/refreshState"
$_body = @{
$ReleaseKey = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\' | Get-ItemPropertyValue -Name Release
if ($ReleaseKey -ge 528040) {
return "4.8 or later";
}
if ($ReleaseKey -ge 461808) {
return "4.7.2";
}
# Ports we want to modify
$Ports = "1:0:0", "1:0:1", "2:0:0", "2:0:1"
# Set the portGroup name
$PortGroupName = "MyPortGroup1"
$StorageSystem = Get-HPOVStorageSystem -Name My3ParSystem
ForEach ($port in $Ports)
{