This has been covered here before but since I had the code in front of me I will post it.
If you need to unmanage and remanage nodes at some future date and time here is a simple way to get the job done. I'm working in Eastern Time so keep that in mind and adjust the display accordingly for your environment. When unmanaging in Powershell the script needs to be set to a UTC time in the future, keep that in mind.
You will need to fill in some info where shown in all caps. Also there is a file where you can place a list of IP's to unmanage, adjust that to the path and filename in your environment.
CLS
Add-PSSnapin SwisSnapin
$swis = Connect-Swis -host YOURORIONSERVERNAME -Trusted
Write-Host " "
Write-Host "Important, the script MUST run in UTC time. Local EST and UTC time is displayed below for reference"
Write-Host "Ensure the variables below for $StartInUTC and $EndInUTC are in UTC"
Write-Host "There is a SWQL query you can run in SWQL studio at the bottom of the script to verify the nodes that you unmanage have the correct times"
Write-Host " "
$dateT = Get-Date -Format "dddd MM/dd/yyyy HH:mm K"
Echo "Current EST Date and Time is $dateT UTC Offset"
$UTCTime = Get-Date -UFormat "%A %B/%d/%Y %T %Z"
$Time = Get-Date
$UTCTIME = $Time.ToUniversalTime()
Echo "Current UTC Date and Time is $UTCTIME"
$StartInUTC = "1/14/2023 13:00:00 PM"
$EndInUTC = "1/14/2023 23:00:00 PM"
Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE IPAddress IN @IPAddress" @{IPAddress=(Get-Content c:\YOURPATH\nodelist.txt)} | Set-SwisObject $swis -Properties @{UnmanageFrom=$StartInUTC;UnmanageUntil=$EndInUTC}
#########################
#Here is the SWQL Query to verify your work
#SELECT TOP 1000 NodeID, IPAddress, Caption, UnManaged, TOLOCAL (UnManageFrom) AS LocalUnManageFrom, TOLOCAL (UnManageUntil) AS LocalReManageTime
#FROM Orion.Nodes
#--Adjust the Where to your needs below
#--Where UnManaged = TRUE
#Where Caption LIKE '%SERVERSYOUARE UNMANAGING%'
#ORDER BY UnManageUntil
Also there is a simple SWQL query you can run at the bottom, it is comment out in the powershell script.
This query will show you the results after you have ran the script in your Local Time so you can verify your work
SELECT TOP 1000 NodeID, IPAddress, Caption, UnManaged, TOLOCAL (UnManageFrom) AS LocalUnManageFrom, TOLOCAL (UnManageUntil) AS LocalReManageTime
FROM Orion.Nodes
--Where UnManaged = TRUE
Where Caption LIKE '%YOURSERVERNAMES%'
ORDER BY UnManageUntil