This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Scheduled Unmanaged Script Time Zone Issue

Hello All,

I have a scheduled unmanage node script that works fine with the exception of the fact that when it schedules the unmanaged time in UTC and I need it to create the schedule in local time (CST).  Does anyone have a way to configure my script to do this?  The script is below:

# 2017-03-29 Node Unmanage script for SolarWinds SDK Powershell

# Version 3.1

# by Chris Good

# This script will unmanage multiple nodes in the Orion database.

# First, it finds the node numbers in the Orion database, then it will unmanage them for the time period specified.

# This script assumes you are running it LOCALLY from a machine that has the Orion SDK installed on it.

# If the machine is not already managed in SolarWinds this script will fail without warning.

#Region PSSnapin presence check/add

#Silently Call SolarWinds SDK

 

if (!(Get-PSSnapin -Name "SwisSnapin" -ErrorAction SilentlyContinue)) 

{     

    Add-PSSnapin SwisSnapin -ErrorAction SilentlyContinue 

}

#EndRegion

#Enter Values

# Fill in values for the fields below

# Not all Node values have to be populated

# All hostnames used must be in SolarWinds, or they will be ignored

[datetime]$start = '2019-05-21 12:00:00 AM'

[datetime]$end = '2019-05-21 12:01:00 AM'

$Username = "tea\jsmith"

$UserPassword = 'password123'

$Node1 = 'darkhorse'

#$Node2 = 'Node2_Hostname'

#$Node3 = 'Node3_Hostname'

#$Node4 = 'Node4_Hostname'

#$Node5 = 'Node5_Hostname'

#$Node6 = 'Node6_Hostname'

#$Node7 = 'Node7_Hostname'

#$Node8 = 'Node8_Hostname'

#$Node9 = 'Node9_Hostname'

#$Node10 = 'Node10_Hostname'

#End Values

#Convert Values

$Password = ConvertTo-SecureString -String $UserPassword -AsPlainText -Force

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $Username, $Password

#End Convert Values

#Send Commands

$swis = connect-swis -Hostname SolarWindsServer -Credential $Cred

$uris = Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE Caption IN ('$Node1')"

$uris | Set-SwisObject $swis -Properties @{UnmanageFrom=$start;UnmanageUntil=$end}

#$uris = Get-SwisData $swis "SELECT Uri FROM Orion.Nodes WHERE Caption IN ('$Node1', '$Node2', '$Node3', '$Node4', '$Node5', '$Node6', '$Node7', '$Node8', '$Node9', '$Node10')"