Posts

Windows Remote Registry Backup

Image
Time for another code snippet. Had to take some registry backups for a rollback plan and here I am with a PowerShell script that enables to backup registry hives from remote computers. I am still in search of a better and easier method as the method which I used makes a lot of assumptions and copying of files here and there. Some interesting points I have to take care when I wrote this script was regarding the encoding in out-file cmdlet and argument passing in an invoke-command script block. Please feel free to add in your suggestions. Function Export-RemoteRegistry () { <# . SYNOPSIS Enables to backup/Export registry hives from remote servers. . DESCRIPTION Enbles to create backup of registry hives from remote servers and copy it to a centralized location. User needs to have admin privilages to the system and registry keys. . PARAMETER ComputerName Accepts a computer nam...

Drive Space Information

Image
One of the scripts which I need to use on a daily basis. This is a basic function of the script to get information on drive space. We can take the result and get a report emailed as a table put into a web page, or simply export it as a CSV file and manipulate as per your need. Usually, I export it as CSV and do some manual manipulation to filter the data which I require. Planning to do some automation on it. I will update the post as I do it... Enjoy!!! <# . SYNOPSIS PowerShell script to report on drive space available on remote windows systems. . DESCRIPTION Get the Availbale Max, availabe drive space information remotely and report it to admins. . PARAMETER ComputerName Accepts a list of computer names or IP addresses . EXAMPLE Get-DriveSpace -ComputerName Server1,server2 . LINK https://posh-scripting.blogspot.in/2017/01/drive-space-information.html #> function Get-DriveSpace { [ CmdletBinding ()] Param ( ...

Check SQL Server Database Status

Image
It's been a month since my last post. Today I am posting a function that can be used to check the status of MS SQL Server databases. At the current moment, I am not sure about the limitations on where this script works like which versions of Windows OS or supported MS SQL Server versions. I have been using the script on my laptop where I have installed Windows 10 OS and SQL Server 2014 Developer Edition. SQL Server Developer edition can be downloaded from here . There are multiple methods to connect to a SQL Server instance from Powershell. I found this very useful article on sqlshack . The script in this post makes use of the SQLPS module. <# . Synopsis Check database status on MS SQL Server instances. . DESCRIPTION Check the database status on one or a list of MS SQL Server instances. . Parameter ServerInstance Provide the server instance to connect to in case of a named instance servername\instancename. . EXAMPLE Get-DBStatus -Serv...

Get IIS AppPool Info

Image
Here is a simple PowerShell function to check the app pool status on remote servers. It make use of Microsoft.Web.Administration Namespace instead of WebAdministration snap-in. Please let me know your feed back. References: https://gallery.technet.microsoft.com/scriptcenter/Powershell-ScriptFunction-2ed89388 https://blogs.msdn.microsoft.com/carlosag/2008/02/10/using-microsoft-web-administration-in-windows-powershell/ <# . SYNOPSIS List the app pools and it' state remotely. . DESCRIPTION Get the app pools and it's status remotely making use of .NET Microsoft.Web.Administration namespace. . PARAMETER ComputerName Provide the name or IP address of a remote computer or a list of computer names separated by a comma. .EXAMAPLE Get-AppPool -Computer comp1,comp2 #> Function Get-AppPool (){ [ CmdletBinding ()] param ( [ parameter ( mandatory = $ True , Position = 1 )] [ string []]$ ComputerName ...

Check Memory Usage

Image
This blog is created as part of my PowerShell learning and getting into the blogging world, so you may see repetitive content. Please bear with me. Here I am posting a simple script that can be used to get RAM memory details from remote windows computers. Please let me know your suggestions on improving the scripts. reference: https://gallery.technet.microsoft.com/scriptcenter/Powershell-Script-to-Get-78687c5e <# . SYNOPSIS Get memory details of a remote server . DESCRIPTION Get the Available physical memory, FreePhysicalMemory, and Percentage of Memory Usage remotely. . PARAMETER ComputerName Accepts a list of computer names or IP addresses . EXAMPLE Get-MemoryUsage -ComputerName computer1 Get-MemoryUsage -ComputerName computer1,computer2 . LINK https://posh-scripting.blogspot.in/2016/10/memory-usage.html #> function Get-MemoryUsage { [ CmdletBinding ()] Param ( # A computer name or list of computer names ...