This should help you create your Powershell script. $SQLDataSet.Tables | Export-Csv -Delimiter ' ' -NoTypeInformation -LiteralPath $CSVPath -Force $SQLConnection.ConnectionString = "Server = $SQLServer Database = $SQLDatabase Integrated Security = True " $CSVPath = "\\FileServer\FileShare\Export.csv" $SQLQuery= $("SELECT AssetStatus, AssetID, Model, Name, Site, ManufacturerName, Type FROM Assets WHERE AssetStatus='3' AND Type='Client' AND Category = 'Hardware'") Here an example of querying and exporting data from a sql table: #SQL parameters The Execute Script Monitor allows you to write your own custom scripts in the VBScript, JavaScript, PowerShell languages, or via an SSH connection to a host. Some years ago I wrote an article on qerying SQL databases, using Powershell (in SMA) and it contains some nice example, which you can use to build your script:Īutomating SQL operations with Service Management Automation (SMA) and Invoke-Sqlcmd – challenges and solutions I can surely help you with the SQL part also. This Script will take the list of URLs from a text tile (in this case from D:URLList.txt) as input, and results output with URL, StatusCode, Description. The interesting part is actually the script itself, which needs to make a SQL connection, run a qquery on the DB and get the results back. 2 Powershell Scripts used in tandem to generate and e-mail a status report of a list of servers and/or workstations. So, as already mentioned, the article will help you integrate your script. Hey, Scripting Guy I am a long time reader, but a first time writer. I have found the same PowerShell script over the Internet. Configure the required parameter, or press 'Load a working sample'. Similar to this question here I am trying to monitor if a set of website links are up and running or not responding. ![]() Use WebSite.ps1 directly from ActiveXperts Network Monitor in the Manager's 'Monitor' menu, select 'New Check (Script)' and select WebSite.ps1. WebSite.ps1 reads data from a web page and searches for a pattern. One more example of how a Powershell script can be used to configure a monitor in SCOM is found in the video: Summary: Microsoft Scripting Guy, Ed Wilson, talks about how to use Windows PowerShell to discover multi-monitor configuration information on your computer. WebSite.ps1 - powershell script by ActiveXperts Software. Monitoring Active Directory User Account Expiration using SCOM and PowerShell (Step by Step Guide) It has some detailed explainations and also screenshots: If (::ASCII.GetString($Monitor.I wrote a blog post on how to integrate a Powershell script in SCOM, using CookDown's PowerShell MP. #Grabs respective data and converts it from ASCII encoding and removes any trailing ASCII null values ![]() The Splunk platform then indexes the output of these commands or scripts as events. $Monitor_Array = each monitor object found and runs the following code: You can use the PowerShell input to run a single PowerShell command or reference a PowerShell script. $Monitors = Get-WmiObject -Namespace "root\WMI" -Class "WMIMonitorID" -ComputerName $Computer -ErrorAction Silentl圜ontinue What i want now that it only pick the those websites which goes down and throes me an alert. As of now i i am running it as a job so whenever any of website goes down it throws an alert on registered mail ID with the HTML file as an attachment consisting of all website status. #Takes each computer specified and runs the following code: I have a PS script which monitors all websites listed in text file. The script will run on the FrameFlow system, so if it needs to reach out to a network device, it needs to implement that ability. ![]() Paste your script into the text box in the event monitor settings. #List of Manufacture Codes that could be pulled from WMI and their respective full names. The first option is for PowerShell 5 the second one supports versions 7 and later. If a site provides an API, go that route instead, as API are sanctioned and provided by the company to use, and require 1 of the resources of loading a full page. In regards to Dell monitors, they most likely will not have the exact same serial number name in the WMI info as is listed on the sticker on the monitor for the serial number. Don’t get greedy in scraping, or try to use it commercially. I used parts of the script to fiddle around with this, mainly the parts that do the WMI reading, the parsing of ASCII and the outputting of the array. PS C:/> $Computers = C:/> Get-Monitor.ps1 -ComputerName $Computers Furthermore, if you scrape too often, you might be blocked from the site temporarily or forever. Manufacturer Model SerialNumber AttachedComputer
0 Comments
Leave a Reply. |