- Community Home
- >
- Software
- >
- HPE OneView
- >
- Powershell: enable-ovmaintenancemode
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
06-26-2024 03:29 AM - last edited on 06-26-2024 08:54 PM by support_s
06-26-2024 03:29 AM - last edited on 06-26-2024 08:54 PM by support_s
Hello,
I've got some scheduled downtime soon and it looks like OneView still doesn't have a maintenance schedule option, so I thought i'd use Powershell to do this, however i'm stuck.
I can see the option "enable-ovmaintenancemode" but when I press enter it just says InputObject, no idea what that is. No matter what I type in it says the following
"Enable-OVMaintenanceMode: The specified 'InputObject' is not an object or is missing the 'ApplianceConnection' property. Please correct this value and try again."
What i'm after is something like enable-ovmaintenancemode -servers server1, server2, server3
Can anyone help out?
Thanks
Solved! Go to Solution.
- Tags:
- OneView
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 08:06 AM
06-26-2024 08:06 AM
Re: Powershell: enable-ovmaintenancemode
You need to pass a server object to the Cmdlet. Using Get-Help Enable-OVMaintenanceMode, you will get the Cmdlet help showing you how to use it. So, for example, you need to use Get-OVServer first to get the list of servers (or alternatively you can get the Server Profile instead using Get-OVServerProfile):
$Server = Get-OVServer -Name Server
Enable-OVMaintenanceMode -InputObject $Server
# You can also use the PowerShell pipeline
Get-OVServer -Name Server | Enable-OVMaintenanceMode
[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
06-26-2024 09:08 AM - edited 06-26-2024 09:12 AM
06-26-2024 09:08 AM - edited 06-26-2024 09:12 AM
Re: Powershell: enable-ovmaintenancemode
Hello,
thanks for that that seems to be working; however how do I remove the prompt for confirmation? I've tried the following
get-ovserver -name servernamehere | enable-ovmaintenancemode -force -confirm:$true
it's saying there isn't a parameter, i'm hoping to have this script created as a scheduled task so needs to run automatically.
Also how can I put in mulitple servers as a list? like servername1,servername2
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 09:13 AM - edited 06-26-2024 09:15 AM
06-26-2024 09:13 AM - edited 06-26-2024 09:15 AM
Re: Powershell: enable-ovmaintenancemode
-Confirm:$false is supposed to override the prompt. -Force isn't a parameter option for Enable-OVMaintenanceMode.
[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
06-26-2024 09:49 AM
06-26-2024 09:49 AM
Re: Powershell: enable-ovmaintenancemode
Are you able to assist in helping with having multiple servers in the script?
That’s just the final bit I hope, one side of our infrastructure is going down, so I need to be able to have multiple servers go into maintenance mode and not all
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2024 01:42 PM
06-26-2024 01:42 PM
SolutionOne technique you can use is to put these servers into a Scope, then use the Scope resource to get the list of servers. That way, you don't have to use some naming scheme for server names to figure out how to locate them using Get-OVServer. For instance:
# Get the scope
$Scope = Get-OVScope -Name ServersForMaintenance
# Process scope resources for server hardware, then enable maintenance mode and saving task objects to runtime variable $Tasks
$Scope.Members | ? Type -eq ServerHardware | % { Get-OVServer -Name $_.Name } | Enable-OVMaintenanceMode -OutVariable Tasks
Then, you can monitor or view the asynctask(s) status in the $Tasks variable. Use the Wait-OVTaskComplete Cmdlet to monitor the progression of the async tasks. By default, all operation-based Cmdlets, like Enable-OVMaintenanceMode, are blocking while it waits for the task to complete. You can check for Cmdlets that support the -Async parameter switch, which will return the async task object immediately upon being accepted by the appliance. Then use the Wait-OVTaskComplete to monitor as previously stated. Keep in mind that the Wait-OVTaskComplete will timeout after 20 minutes. That does not mean the task failed if the timeout is reached. You can override it with the -Timeout parameter in Wait-OVTaskComplete.
[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
06-27-2024 01:33 AM
06-27-2024 01:33 AM
Re: Powershell: enable-ovmaintenancemode
Awesome thank you, thats worked a treat using the scopes, thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2024 04:05 AM
06-27-2024 04:05 AM
Re: Powershell: enable-ovmaintenancemode
That's excellent!
We are extremely glad to know the issue has been resolved and we appreciate you for keeping us posted.