#################### Test Where statement - BEGIN #################### #region #set searchterm array $CreatedAfter = (Get-DAte).AddDays(-7) $AssigneeSsos = @("mart6141") $SearchTerms = @{} $SearchTerms.Add("AssigneeSsos",@("current_assignee_sso","in", [System.Collections.ArrayList]$AssigneeSsos)) $SearchTerms.Add("CreatedAfter", @("created","<","$($CreatedAfter.ToString("yyyy-MM-dd HH:mm:ss"))") ) $TicketAttributes = Get-CoreTicketAttributes -Attributes Group1 $Result = Invoke-CoreWhereWrapper -SearchTerms $SearchTerms -Attributes $TicketAttributes -Class Ticket -QueryLimit 20 $Result.result | ft <# Returns all tickets in the Imp prov queue that are open and subjects contain "Provisioning-Master" or "Implementation Tracking Ticket" Will filter out tickets with no windows devices and return subtickets It will also return devices attached to the ticket, with SKUs #> Function Get-CoreTicketImplementationMasterTickets { [Hashtable]$ParamSplat =@{ State = 'Open'; Queues = 510; #Provisioning UK - Imp Team Subjects = [Array]("Provisioning-Master","Implementation Tracking Ticket"); HasWindowsDevices = $true Verbose = $true } $Result = Find-CoreTicket @ParamSplat #Core explodes if you try to get devices as as well as tickets, so we break them out #$Devices = Get-CoreTicketDevices2 -Tickets $Result.number -AdditionalDeviceAttributes Skus Return $Result } #testing all params in Find-Coreticket $t = Find-CoreTicket -State Open -AssigneeSsos "mart6141" -Accounts "1103359" -CreatedBefore (Get-Date) -CreatedAfter (Get-Date).AddDays(-7) -Queues 683 -HasWindowsDevices -QueryLimit 15 $t = Find-CoreTicket -State Both -Tickets "161125-03022" $t = Find-CoreTicket -State Both -Devices "701380" -Subjects "E2E" #endregion ##################### Test Where statement - END ##################### #################### Test ticket attribute and subattributes - BEGIN #################### #region #Testing attribute asets $t = Find-CoreTicket -State Both -Tickets "161125-03022" -Attributes Group1 -Subattributes Devices $t.result $t.result.devices.subattributes $t = Find-CoreTicket -State Both -Tickets "161125-03022" -Attributes Group1,Group2 $t = Find-CoreTicket -State Both -Tickets "161125-03022" -Subattributes Devices $t.result.devices.subattributes #Testing subattributes $Tickets = @("170113-09038") $SearchTerms = @{"Tickets" = [Array]("number","in", [System.Collections.ArrayList]$Tickets)} $Attributes = Get-CoreTicketAttributes -Attributes Group1,Group2 -Subattributes Subtickets,Devices,Messages $result = "" $result = Invoke-CoreWhereWrapper -Attributes $Attributes -Class "Ticket" -QueryLimit 150 -SearchTerms $SearchTerms $result.result.devices $result.result.subtickets $result.result.messages #endregion ##################### Test ticket attribute and subattributes - END ##################### #################### Test METHOD - BEGIN #################### #region $LoadArgument = "170120-06442" $Computer = "560559" $KeywordArgs = @{computer = "$Computer"} $Method = "addComputer" $Class = "Ticket" #add device Invoke-CoreMethodWrapper -LoadArgument $LoadArgument -KeywordArgs $KeywordArgs -Method $Method -Class $Class #remove device Invoke-CoreMethodWrapper -LoadArgument $LoadArgument -KeywordArgs $KeywordArgs -Method "removeComputer" -Class $Class #getting sku method $Computer = "560559" $sku = Invoke-CoreMethodWrapper -LoadArgument $Computer -KeywordArgs @{} -Method "getSKUsAndLabels" -Class Computer #NOT WORKING #giving a 500 error, not sure why, need to verify the json matches one created by current Set-CoreDeviceStatus #change status on device #9 = seg config, 12 = online #Invoke-CoreMethodWrapper -LoadArgument $Computer -KeywordArgs @{new_status = "12" ; reason = "testing"} -Method "changeStatus" -Class Computer #Invoke-CoreMethodWrapper -LoadArgument $Computer -KeywordArgs @{new_status = 9 ; reason = "testing"} -Method "changeStatus" -Class Computer #endregion ##################### Test METHOD - END ##################### #################### Test Set_attribute - BEGIN #################### #region #change nick name $Computer = "560559" Invoke-CoreSetAttributeWrapper -LoadArgument "$Computer" -SetAttributes @{"nickname" = "ttt"} -Class Computer #endregion ##################### Test Set_attribute - END #####################