Showing posts with label powershell. Show all posts
Showing posts with label powershell. Show all posts

Friday, November 7, 2014

Hyper-v capacity report (Powershell). Part 1

I am going to write about capacity. Some days ago one of our managers asked me about the ISO 20.000 and the capacity plan. He was looking for a simple dashboard to display our hypervisors capacity every month. So, I thought that using Powershell and SSRS could be a good idea to display and access this information.
So in this post I am going write about the draft version of the system that will generate this capacity dashboard.

Sunday, December 15, 2013

Wsus report with powershell


Last Tuesday, someone in our department asked us if it is possible to get a report via email that displays information about failed computers.

By default Windows 2008 R2 does not provide WSUS cmdlets, so we need to load WSUS assemblies from .NET, here is a URL with the method and properties http://msdn.microsoft.com/en-us/library/microsoft.updateservices.administration(v=vs.85).aspx

Recipe: IAS log parser

Today we need to parse an IAS log, we need to know who are logging in the system. Usually we use IASLogparser, but unfortunately in this case we did not have the license.
So, we need to read the file specifications from Microsoft in this URL http://technet.microsoft.com/es-es/library/dd197432(v=ws.10).aspx  and parse the log file.
We selected Powershell as our script language and it was easy to build a parser, we made it in less than one hour.

Tuesday, November 26, 2013

Recipe: last MSI installed on a computer

This is a PoC of Powershell script to monitor MSIs installed packages in the local machine, it is ready to run every 5 minutes and launches an action if anything is installed in this period of time.


 #Deploy as 5 minutes management task.  
  $softinst=Get-EventLog application -InstanceId 1033 -Source MsiInstaller -Before ([System.DateTime]::Now) -After ([System.DateTime]::Now).AddMinutes(-5)  
  if ($softinst -eq $null)  
  {  
   Write-Host "No new software installed in the last 5 minutes"  
  }  
  else{   
  #Skip autoupdates  
  if ($_.Message -notcontains "Microsoft Endpoint"){  
  #Action  
  }  
  }  

You can run it as scheduled task and send email as action to control every 5 minutes which are the new MSI packages installed in one machine.
You can deploy it across domain using GPO and scheduled task ( http://technet.microsoft.com/en-us/library/cc725745.aspx ) using powershell.exe with parameter -command{} and invoke-command{\\UNC\scripts}
Remember the execution policy, you can manage it with GPO in Computer Configuration | Administrative Templates | Windows Components | Windows PowerShell and configure the Turn On Script Execution setting

Thursday, November 21, 2013

SCOM scripting basics

This is the part three of a set of articles related to SCOM


Why scripting with SCOM?

Scripting is the most powerful tool in SCOM, with scripts and imagination you can monitor everything, from a folder in the filesystem to a coffee machine.

Usually we use Visual Basic Script for scripting in SCOM, because it works in all Windows systems, from 2003 to 2012R2, but you can use Powershell if you prefer,  as long as it is installed in the monitored system. Bash or Python can be used as well, if you are monitoring Linux servers.
Scripts could be emebeded in Management packs or can be developed from the administration console as monitor or rule.
This article is focused on monitor scripts, but it can give you an idea about how scripts work in SCOM and how to use them on rules or management packs.

Tuesday, November 19, 2013

Recipe to get hits per browser by URL

This is our first recipe, a short article describing a specific task.
Today we need get hits by browser in specific URLs.
We have used the following tools, Logparser Lizard,Powershell and Excel to present a graphic report.