Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

PowerSQL By Prashanth Jayaram

Technology enthusiast with 7+ years of experience in Database Technology. I am Microsoft Certified Professional with certificates of OCA, MCP, MCTS, MCITP developer, MCITP administration and backed with a degree in Master of Computer Application. My expertise lies in T-SQL programming, Replication, PowerShell and Performance Tuning. Hobbies are Drawing, playing soccer and listening to Melodies songs.

PowerShell- Monitoring Multiple Service on a Group of Servers

I got a request to monitor multiple services and send an email to intended recipients. This post explains how to monitor a multiple services on a group of servers. The function Get-ServiceStatusReport comprises of various cmdLets and function to monitor services on a list of servers.

  • Get-Service
  • HTML Ouptut
  • Email…

Read more

10 comments, 251 reads

Posted in PowerSQL By Prashanth Jayaram on 4 December 2013

Disk Space GUI Tool – Multiple Servers with GridView and Email Output

This tool helps you get the disk space information on the computers of your choice. Either you can type the path of an input file or hit ‘Browse Button’ to select the file using dialog option.

Put the select input file and hit ‘GetDisk’. It will query the disk space… Read more

5 comments, 168 reads

Posted in PowerSQL By Prashanth Jayaram on 3 December 2013

PowerShell – Service Comparison GUI Tool

Service Comparison GUI Tool  does comparison of all the services of any given two servers. The output is a grid view and sorting can be done on a required columns. The result is a combination of unique services and the same services are of different state.

Copy and paste the… Read more

0 comments, 374 reads

Posted in PowerSQL By Prashanth Jayaram on 11 November 2013

PowerShell – Disk Space GUI Tool

PowerShell – Disk Space GUI Tool - Sharing a useful PowerShell GUI script to check disk drive usage along with a graph.

Copy and paste the below code on Powershell-ISE for better execution.

 Tool Details :The layout details are as follows

When we made a wrong entries, message box… Read more

10 comments, 2,215 reads

Posted in PowerSQL By Prashanth Jayaram on 14 October 2013

PowerShell – Script to Monitor Disk Space of a Group of servers – HTML Formatted Email Output

This post explains how to monitor DiskSpace of a group of listed servers in a text file.

The function Get-DiskSpaceReport comprises of various cmdLets and function to monitor Disk Drives.

  • Get-Win32LogicalDisks
  • HTML Ouptut
  • Email Address validation

You can customize it as per your requirement.The Function Get-DiskSpaceReport has six input parameters:- Read more

10 comments, 1,128 reads

Posted in PowerSQL By Prashanth Jayaram on 1 October 2013

PowerShell – Restart Service – Local or Remote Machines

This post is to start the services of local or remote computers. It also check for all its dependent services.  The script works on below logic

  • Service status is Running

The script will stop the dependent services ,stop the main service , start the dependent service and then start the… Read more

0 comments, 439 reads

Posted in PowerSQL By Prashanth Jayaram on 23 September 2013

PowerShell – Script to Monitor a Service on a Group of servers – HTML Formatted Email Output

This post explains how to monitor a given service on a group of servers. The function Get-ServiceStatusReport comprises of various cmdLets and function to monitor any given service on a list of servers.

  • Get-Service
  • HTML Ouptut
  • Email Address validation

You can customize it as per your requirement.

The Function Get-ServiceStatusReport… Read more

10 comments, 2,183 reads

Posted in PowerSQL By Prashanth Jayaram on 17 September 2013

PowerShell – List Local or Remote Programs with an Exclusion List of Programs

This post is to list all the software installed on your local or remote machines. The exclusion list is an array item which holds the programs  that you wanted to exclude it from displaying.

********************************************************************************

Function Get-SoftwareList {
param(
[CmdletBinding()]
[string[]]$ComputerName = $env:COMPUTERNAME
)

$writeArray=@()
$excludeArray=@()
#List of programs to… Read more

4 comments, 367 reads

Posted in PowerSQL By Prashanth Jayaram on 16 September 2013

PowerShell – Uptime of Multiple Machines – Example for Custom Formatting and Grid View

This post is to help you out in finding UpTime of one or more computers also you can pass file as its input parameter . Most of the time, the Powershell console might not fit all the required output columns. By default, the ordering of the columns are based on… Read more

0 comments, 250 reads

Posted in PowerSQL By Prashanth Jayaram on 9 September 2013

PowerShell – Delete Registry Entries – Remote Machines – Example Profile Deletion

 

#The following SID registry entry to be deleted across all mutiple Machines, SID is a user #who owns this user profile. Run the below script in Powershell console or ISE

$sid = ‘S-1-5-21-3656904587-1668747452′

$scriptblock = {
param($sid)
$regpath = ‘HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList’
Remove-Item -path (Join-Path $regPath $sid) -force -recurse
} Read more

0 comments, 531 reads

Posted in PowerSQL By Prashanth Jayaram on 6 September 2013

SQL – Find CPU,Memory,Connections, VLF’s,I/O of all the Databases

Find CPU, Memory, No Of Connections/databases and VLF’s and I/O details in one single script. 

You just need to run the below T-SQL in SSMS

Download the code here Metrics

*****************************************************************************

USE MASTER

GO
DECLARE @DML1 nvarchar(MAX),
@DML2 nvarchar(MAX),
@DML3 nvarchar(MAX),
@DML4 nvarchar(MAX)

DECLARE @Aggregate_IO_Statistics TABLE
(
[I/O Rank] [bigint]… Read more

4 comments, 816 reads

Posted in PowerSQL By Prashanth Jayaram on 3 September 2013

SQL – Identify & Drop Duplicate Index

This post explains the simple steps to identify a duplicate indexes in all the databases.  The duplicate index are more than one indexes that differ only by it’s name but consist of identical fields internally. It generates overhead when performing updates, inserts or deletes, require lot of resources for rebuilds,… Read more

4 comments, 276 reads

Posted in PowerSQL By Prashanth Jayaram on 26 August 2013

SQLCMD – Database Backup and Restore – Automation – Quickest and Simplest method

In today’s world we rely more on third party tools to do a Backup and Restore of databases. Most of us still use SQL Native method to do a Database Backup and Restoration. This post illustrates the quickest way of taking backup and restore it on the destination server. I’m… Read more

0 comments, 740 reads

Posted in PowerSQL By Prashanth Jayaram on 19 August 2013

PowerShell – Invoke Commands,Batch files & Executable file – Dynamically passing Parameters

I’ve recently got a request to invoke an executable file from Powershell. Different ways of executing a executable file is given below. The advantage is that either you can pass the parameters dynamically by reading it from a text file or using variables.

  1. You can use Invoke-Expression
  2. Use of  call…

Read more

0 comments, 455 reads

Posted in PowerSQL By Prashanth Jayaram on 14 August 2013

SQL – One Query to fetch SQL Jobs Details of All SQL Version – 2000/05/08/R2

Single Query to fetch complete details of sql jobs and you can run it across different version of SQL [2000/2005/2008 and R2]. I’ve undergone dynamic query string limitation issue and hence I’m including the workaround details in the same post. The dynamic query cannot exceed 4000 characters. The workaround is… Read more

4 comments, 863 reads

Posted in PowerSQL By Prashanth Jayaram on 12 August 2013

SQL – Find Database File Usage Details – 2000/05/08/R2

This post is to find the database file usage details of all databases of an instance. The query runs on all versions of sql 2000/2005/2008/R2 . The requirement is to use same query to be executed it across all version of SQL SERVER.  We can  also do this using dynamic… Read more

0 comments, 422 reads

Posted in PowerSQL By Prashanth Jayaram on 6 August 2013

SQL – Query to find data,log,Total Size and other Useful information of all databases – SQL 2000/2005/2008/R2

I’ve encountered a situation where I need to find out the database file,log file, total size and other useful information about a database on SQL Server 2000/2005/2008/R2 versions. The requirement is to use same query and it has to be executed across all version of SQL SERVER.  We can  also… Read more

6 comments, 854 reads

Posted in PowerSQL By Prashanth Jayaram on 25 July 2013

PowerShell – Identify and switch between installed PowerShell Versions

Most of the time we have been used to cmdlets and it’s various features but do not know about the version and hence this post might help some of you to understand in finding different versions of PowerShell and how to switch between versions (provided multiple versions are installed on… Read more

2 comments, 363 reads

Posted in PowerSQL By Prashanth Jayaram on 17 July 2013

PowerShell – Get CPU Details and its Usage

This PowerShell script helpful in finding No of Processors, Speed and It’s current usage based on samples being gathered at frequent intervals.

/* Get No of Processors,Speed and its usage*/

Function Get-CPUs {
param ($server)
$processors = get-wmiobject -computername $server win32_processor
$cpuSpeed = ((get-wmiobject -computername $server Win32_Processor).MaxClockSpeed)/1000
$cores=0
if (@($processors)[0].NumberOfCores) Read more

2 comments, 423 reads

Posted in PowerSQL By Prashanth Jayaram on 11 July 2013

PowerSQL – Find OS and Memory Usage Details – Multi Server Script – No Input files

Multi Server script to find OS and Memory details.  It doesn’t require a text file as its input but you have to pass computer names as its parameters which are separated by comma.

function Get-OSMemory {
param(
[string[]]$ComputerName = “.”
)

foreach ($Computer in $ComputerName) {
if(Test-Connection -ComputerName $Computer -Count… Read more

2 comments, 305 reads

Posted in PowerSQL By Prashanth Jayaram on 9 July 2013

Newer posts

Older posts