I am attempting to set this up and want to see what I am missing. 2 issues I see ... 1 - it doesn't run 2 - it is slow to load the sqlps module

Set-Executionpolicy UnRestricted -force

Import-Module sqlps -DisableNameChecking

$DataDate = Invoke-Sqlcmd -Query "select top (1) date_timestamp from tbl_data where desc_id like 'OFF%' order by date_timestamp desc;" -Database "Prd_INTEG" -U "SQLMonitor" -P "Password"

$CurrentTime = Invoke-Sqlcmd "SELECT GETDATE() AS TimeOfQuery;"

$TimeDiff = New-Timespan -Start $DataDate.Date_timestamp -End $CurrentTime.TimeOfQuery

if ($TimeDiff.TotalHours -gt 6) { $mon.FireActions = $true $mon.Details = "No Data in $TimeDiff.TotalHours hours" } else {$mon.FireActions = $false}

asked 13 May '15, 08:30

TeBear's gravatar image

TeBear
111
accept rate: 0%


Error executing PowerShell script.

[6-Mon]

Is the error I am getting

link

answered 13 May '15, 08:37

TeBear's gravatar image

TeBear
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×44
×23
×10

Asked: 13 May '15, 08:30

Seen: 5,496 times

Last updated: 13 May '15, 08:37