- Community Home
- >
- Software
- >
- HPE OneView
- >
- OneView REST API force discover hardware server
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
Forums
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
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
03-16-2022 07:57 AM
03-16-2022 07:57 AM
Hello Guys,
I'd like to know if that is possible to force discover hardware server via OneView REST API?
Since I have 100+ HPE servers managed by another Oneview Instance(crashed ), I don't like to click the option "force add hardware server " one by one when I add them into my new Instance,
Is there something like below, by adding parameters like force Ture?
POST https://{appl}/rest/server-hardware/discovery
Auth: abcdefghijklmnopqrstuvwxyz012345
X-Api-Version: 3600
Content-Type: application/json
Accept-Language: en_US
{
"mpHostsAndRanges" : ["enc-ilo.corp.com", "172.1.1.1-172.1.1.10"],
"username" : "Administrator",
"password" : "mypassword",
"licensingIntent":"OneView",
"configurationState":"Managed",
"force": ture,
"initialScopeUris": ["/rest/scopes/13c1606f-f1cb-473b-9c01-02e3a1a54589"]
}
I very much appreciate it if there is any update, thanks in advance.
Best Regards
Seven
BTW the failed error logs FYI
Validate server information.
IssueServer already monitored
Server {0} cannot be added as it is already being monitored.ResolutionRelease the server from its current manager and try again, or retry the request using force option.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2022 08:57 AM
03-16-2022 08:57 AM
Query: OneView REST API force discover hardware server
System recommended content:
1. HP OneView REST API Reference
2. HPE StoreOnce REST API and SDK version 3.18.x User Guide
Please click on "Thumbs Up/Kudo" icon to give a "Kudo".
Thank you for being a HPE valuable community member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2022 09:15 AM
03-16-2022 09:15 AM
Re: Query: OneView REST API force discover hardware server
HI,
Thanks for your updates,
I have lookup the API reference and the Links you provide, it doesn't work.
Based on Powershell HPEOneView.600 Add-OVServer help:
-Confirm <SwitchParameter>
When attempting to add a Server to the appliance, the appliance will validate the target Server is not already claimed. If it is, this parameter is used when the server has been claimed by another appliance to bypass the confirmation prompt, and force add the server resource.
It still doesn't work.
Add-OVServer -Hostname $IP -Confirm -LicensingIntent OneView -Password $passwd -Username $user
Add-OVServer : "The server hardware has already been added as "". Release the server from its current manager and try again, or retry the
request using force option. If the server is orphaned, use Remove-OVServer -Force Cmdlet, and then try your add again.
At line:1 char:1
+ Add-OVServer -Hostname IP -LicensingIntent OneView -Pass ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceExists: (Hostname:String) [Add-OVServer], ServerHardwareResourceException
+ FullyQualifiedErrorId : ServerResourceExists,Add-OVServer
Thanks
Seven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2022 11:02 AM
03-16-2022 11:02 AM
SolutionYour use of the Cmdlet is off. It should be:
Add-OVServer -Hostname $IP -Confirm -LicensingIntent OneView -Password $passwd -Username $user -Confirm:$false
The -Confirm switch is a common PowerShell parameter.
As for a native REST API call, one does not exist. We never scoped the add host range to force claim. This would cause severe sideaffects we didn't want customers to get themselves into. Instead, you need to loop through a collection of iLO addresses and use the JSON force property instead.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2022 07:44 PM
03-20-2022 07:44 PM
Re: Query: OneView REST API force discover hardware server
Hi Chris,
Thanks, much, for the REST API, refer to your recommendations, I can do it now via the script below:
for i in {10..100}
do
data="{ \"hostname\":\192.168.1.${i}\",\"username\":\"admin\",\"password\":\"passwd\",\"force\":true,\"licensingIntent\":\"OneView\",\"configurationState\":\"Managed\" }"
echo $data
curl -k -H "accept: application/json" -H "content-type: application/json" -d "${data}" -H "auth: $sessionID" -X POST https://{appl}/rest/server-hardware
done
For the Cmdlet, It also works via cmd below:
PS> Add-OVServer -Hostname 192.168.1.100-Password passwd -Username admin -Confirm:$true
Appliance Name Owner Created Duration TaskState PercentComplete
--------- ---- ----- ------- -------- --------- ---------------
appl Add administrator 3/21/2022 3:38:45 AM 00:00:29 Completed 100
Thanks again, have a great day.
Best Regards
Seven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2022 03:11 AM
03-23-2022 03:11 AM
Re: Query: OneView REST API force discover hardware server
Hi Seven,
Just a throught - an alternative to using all of the backslashes:
data="{ \"hostname\":\192.168.1.${i}\",\"username\":\"admin\",\"password\":\"passwd\",\"force\":true,\"licensingIntent\":\"OneView\",\"configurationState\":\"Managed\" }"
try:
data='{"hostname":"192.168.1.'${i}'","username":"admin","password":"passwd","force":true,"licensingIntent":"OneView","configurationState":"Managed"}'