Showing posts with label Spiceworks. Show all posts
Showing posts with label Spiceworks. Show all posts

Tuesday, January 7, 2014

PowerShell: Connectivity Monitor with Email Alert

Recently saw a post on Spiceworks that caught my eye. A poster was looking to improve a batch script by using PowerShell.  The purpose of this batch script was to test connectivity of a site based on ping.  The script worked as needed but was giving false negatives.  To resolve the poster wanted to have it test ping twice.

Below is the PowerShell script that Martin Pugh (Martin9700) provided, the thread can be viewed here: http://community.spiceworks.com/topic/427943-ping-test-script?page=1#entry-2863765

 # +-----------------------------------------------------------------------------------  
 # | File : Connectivity Monitor with Email Alert.ps1                       
 # | Version : 1.01                       
 # | Purpose : Provided CSV of IPs will test for connectivity (see comments at end)  
 # |           Ping list of IPs for connectivity  
 # |           If failed wait and repeat ping  
 # |           If failed 2nd time send alert email  
 # |        
 # | Based on: Martin Pugh (Martin9700) SpiceWorks thread  
 # |      http://community.spiceworks.com/topic/427943-ping-test-script?page=1#entry-2863455  
 # +-----------------------------------------------------------------------------------  
 # | Maintenance History                        
 # | -------------------                        
 # | Name      Date    Version C/R Description      
 # | ----------------------------------------------------------------------------------  
 # | Martin Pugh   2014-01-07   1.01     Initial scirpt build  
 # +-----------------------------------------------------------------------------------  
   
 ###SETUP START###  
      #Path to file with IP addresses  
           $Path = "[PATHTOYOURIPLISTCSVDOCUMENT]"  
      #SMTP Server to be used  
           $smtp = "{YOURSMTP]"  
      #"From" address of the email  
           $from = "ServerReports@{YOURDOMAIN].com"  
      #Enter Admin Email Address  
           $to="[YOURADMIN]@[YOURDOMAIN].com"  
 ###SETUP END###  
   
 ###PROGRAM START###  
      ForEach ($IP in (Import-CSV $Path))  
           {If (-not (Test-Connection $IP.Address -Quiet -Count 2))  
                {Start-Sleep -Seconds 2  
                     If (-not (Test-Connection $IP.Address -Quiet))  
                          {#Send Alert Email  
                               Send-MailMessage -To $to -From $from -Subject "Problem with $($IP.Location)" -Body "Problem detected with site at $($IP.Location), $($IP.Address)" -SmtpServer $smtp  
                          }  
                }  
           }  
 ###PROGRAM END###  
   
 ############################REMOVE AFTER SETUP##############################################  
 ######CSV file needs to have following format######  
 #Location,Address  
 #Sitename1,x.x.x.x  
 #Sitename2,x.x.x.x  

Friday, December 20, 2013

Holiday IT Poem

'Twas the week before Christmas
And all through SpiceWorks
There were plenty of tickets
Put in from dumb jerks.
Their computers weren't working
Or so they all said
But the IT folks knew
Users are brain-dead
Still every ticket was logged
Every problem looked at
Encountering every user
And pictures of their cats
There was a printer jam
And one with no ink
One had no paper
And someone clogged the sink
That shouldn't be IT
That we all know
But the ticket still came in
So a plumbing I will go
As the weekend draws near
I just impatiently wait
It's almost Saturday
And won't that be great!
My presents are bought
My shopping is done
Everything's even wrapped
So now I just get to have fun
A weekend of Xbox
Playstation and Wii
So now I might be at work
But soon I'll be free!
And then next week comes
And everyone will be merry
And they'll all call off work
So my tickets won't be scary
Plus a day off on Wednesday
Oh what a delight
So Merry Christmas to all!
Especially SpiceRex

Tuesday, October 29, 2013

Spiceworld

Unable to attend Spiceworld 2013 check out the uStream feed:

  • http://www.ustream.tv/channel/spiceworld-2013

or following directions to watch via VLC:


  • Install LiveStream (https://github.com/chrippa/livestreamer/releases/tag/v1.6.1) 
  • Open CMD browse to Livestream folder Execute following: livestream.exe
  • http://www.ustream.tv/channel/spiceworld-2013 best should open in VLC
Check out the Agenda:

Monday, August 26, 2013

Spiceworks: Generate Ticket for upgrade notice

This is quick write up of experience implementing How-To: How to automatically create a ticket on Spiceworks upgrade by Vasily Ignatov.

Objective: Generate a ticket in Spiceworks when upgrade is released.  Provides upgrade history and ensures completed in timely manner.

  1. Navigated to following link and save the script:
  2. Create a storage directory 
    • Create a directory for downloaded Spiceworks installers and define the path_to_store_exe variable in the script. Grant write access to this folder for account, which will run the script.
    • We used \\server\shared\IT\Software\Spiceworks\Installers
  3. Fill in other variables in the script
    • All settings to fill in bounded with lines "=== Define your parameters ==="
      • $smtp_server = "smtp.domain.com"
      • $smtp_server_port = "25"
      • $SSL_is_used = $false
      • $ticket_creator_email = "admin@domain.com"
      • $ticket_creator_email_pass = ""
      • $helpdesk_email = "helpdesk@domain.com"
      • $helpdesk_url = "http://helpdesk.domain.com:port"
      • $path_to_store_exe = "D:\SW-Install\"
      • $LANG = "EN"
  4. Schedule a task Schedule a task to run the script every day at 09 AM or whenever you want.
    • Start > Run > Taskschd.msc
    • Task Scheduler Library > Action > Create Task
    • General
      • Name: Spiceworks Ticket Upgrade
      • Description: Run PS script to check for Spiceworks updates.  Generate ticket as needed.
      • Security Options: Run whether user is logged in or not
    • Triggers
      • New > On a schedule
      • Settings 
        • Define when you want to run
      • Advanced Settings
        • Ensure Enabled is checked
        • I like to set stop for tasks if they run more then an hr
    • Actions
      • New > Start a program
      • Settings:
        • Program/script: powershell
        • Add Arguments: -file [path to script enclose in "" if spaces in path]
    • Conditions
      • Adjust as needed
    • Settings
      • Adjust as needed
    • History
      • Log to verify running
    • Upon saving will be prompted for user password
That is it.  Now in the folder you have defined installers will be downloaded being named according to versions.  Also in the folder will be the log file (check_sw_ver.log) and the md5sums.

Download script, readme and task scheduler template at:
https://docs.google.com/file/d/0B1fwreWrAZiobmlXT1Y1ZGpCSEE/edit?usp=sharing