Skip to content

Instantly share code, notes, and snippets.

View ChrisLynchHPE's full-sized avatar

Chris Lynch ChrisLynchHPE

View GitHub Profile
Add-Type @"
namespace System.Security.Cryptography.X509Certificates {
public enum X509KeySpecFlags {
None = 0,
AT_KEYEXCHANGE = 1,
AT_SIGNATURE = 2
}
}
"@
function Convert-PemToPfx {
"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
$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
$ServerName = "ReplaceMe"
$Server = Get-HPOVServer -Name $ServerName
$Credential = Get-Credential
$_InputObject = $Server.PSObject.Copy()
$_uri = $_InputObject.uri + "/refreshState"
$_body = @{

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:

@ChrisLynchHPE
ChrisLynchHPE / Invoke-IPPoolCollector.ps1
Last active October 21, 2019 17:24
This script will invoke the IP Pool Collector service that will attempt to reclaim addresses that were not released during resource removal. Example resources that can consume IPv4 Addresses from pools are Logical Enclosures, OS Deployment Servers and Hypervisor Cluster Profiles.
# Replace the -NetworkID parameter with the right Subnet Pool ID to reclaim addresses
$subnet = Get-HPOVAddressPoolSubnet -NetworkId 10.41.87.0
ForEach ($range in $subnet.rangeUris)
{
$_Uri = $range + '/allocated-fragments?start=0&count=1'
$_AllocatedFragments = Send-HPOVRequest -uri $_Uri
$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";
}