- Community Home
- >
- Servers and Operating Systems
- >
- HPE ProLiant
- >
- Server Management - Remote Server Management
- >
- automate ilo user account on synergy servers
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
07-16-2019 10:53 AM
07-16-2019 10:53 AM
automate ilo user account on synergy servers
Do anyone have any working scripts to automate creating ilo user accounts on synergy blades using OneView SSO? I am trying to use the script below but it fails with an error.
#This is first version (1.0) of ILO user add script for all servers throught SSO token with POSH-OV module
#
#--------------------uncomment this if you want to connect to OV------------
#write-host -ForegroundColor Yellow "You need to autorize at OneView.."
#$OVIP1 = Read-Host 'What is OV IP?'
#$OVuser1 = Read-Host 'What is OV Username?'
#$OVpass1 = Read-Host 'What is OV Username?' -AsSecureString
#$OVpass11 = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($OVpass1))
#Connect-HPOVMgmt -Hostname $OVIP1 -UserName $OVuser1 -Password $OVpass11
#--------------------uncomment this if you want to connect to OV------------
#Disable-HPERedfishCertificateAuthentication #Use this one if you're using new HPERedfishCmdlets module
Disable-HPRESTCertificateAuthentication #Use this one if you're using old HPRestCmdlet module
write-host -ForegroundColor Yellow "Please Choose ILO credentials...."
$ILOuser1 = Read-Host 'What is ILO Username?'
$ILOpass1 = Read-Host 'What is ILO password?' -AsSecureString
$ILOpass11 = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($ILOpass1))
$Num1=Get-HPOVServer -Name "SCACP-HPE102, bay 6" | Measure-Object
$Num2=$Num1.Count
write-host -ForegroundColor Yellow "You have $Num2 Servers...."
sleep 1
$server1=Get-HPOVServer -Name "SCACP-HPE102, bay 6"
for ($i=0;$i -lt $Num2; $i++) {
$IloSession = Get-HPOVServer -Name $server1[$i].name | Get-HPOVIloSso -IloRestSession
#$UserILO1=Get-HPRESTDataRaw -Href "/rest/v1/AccountService/Accounts" -Session $IloSession
##---User data---
$PrivList = @(
'RemoteConsolePriv',
'iLOConfigPriv',
'VirtualMediaPriv',
'UserConfigPriv',
'VirtualPowerAndResetPriv')
$priv = @{}
foreach ($p in $PrivList)
{
$priv.Add($p,$true)
}
$hp = @{}
$hp.Add('LoginName',$ILOuser1)
$hp.Add('Privileges',$priv)
$oem = @{}
$oem.Add('Hp',$hp)
$Headers = @{}
$Headers.Add("UserName" , $ILOuser1)
$Headers.Add("Password" , $ILOpass11)
$Headers.Add('Oem',$oem)
Invoke-HPRESTAction -href "/rest/v1/AccountService/Accounts" -data $headers -Session $IloSession
Disconnect-HPREST -Session $IloSession
}
Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (400) Bad Request."
At C:\Program Files\WindowsPowerShell\Modules\HPRESTCmdlets\1.2.0.0\HPRESTCmdlets.psm1:2038 char:21
+ ... [System.Net.WebResponse] $resp = $httpWebRequest.GetRespo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Exception calling "Create" with "1" argument(s): "Invalid URI: The format of the URI could not be determined."
At C:\Program Files\WindowsPowerShell\Modules\HPRESTCmdlets\1.2.0.0\HPRESTCmdlets.psm1:1937 char:5
+ $wr = [System.Net.WebRequest]::Create($useUri)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : UriFormatException
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2019 01:01 AM
07-26-2019 01:01 AM
Re: automate ilo user account on synergy servers
Hello ,
I hope you can use the below script from github.
https://github.com/DungKHoang/Create-iLO-accounts-with-RESTFul-API-from-OneView
Regards,