• Install RSAT Tools on Windows 10

    I've written a short script to download and install the RSAT tools for Windows 10. This script works on the recent versions of Windows 10 only! Here goes: # Install-RSATTools.PS1 # Thomas Lee - [email protected] # 1. Get Windows Client Version and Hardware platform $ Key = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' $ CliVer = ( Get-ItemProperty - Path $ Key ) .ReleaseId $ Platform = $ ENV... Read…
  • uBlock Origin–An Ad Blocker for the Edge browser

    uBlock Origin is a free open source browser extension that does content filtering and ad blocking. This extension now is available for the Edge browser and is available in the Windows Store. To use it, you just install it and away you go. It just works. I tried it on one particular site that has a lot of ads AND refuses to show any content if you are using and ad blocker. Not only does that site not... Read the full text…
  • My Ten Tips For Technical Writing

    I have written many hundreds of thousands of words over my career – not only work product, but books, trade publication articles and so on. Over that time, I’ve read far more then I’ve written. And in that time, I’ve slowly developed a set of rules for how I write. Or for how I hope to write! In my career, I have had three great writing mentors: Keith Burgess, Roy Chapman, and Susan Greenberg. Keith... Read the full text…
  • Install-RMAzureVmCert

    Function Install - WinRMAzureVmCert { < # . SYNOPSIS Downloads and installs the certificate created or initially uploaded during creation of a Windows based Windows Azure Virtual Machine . . DESCRIPTION Downloads and installs the certificate created ( or uploaded ) during the creation of a Windows based Windows Azure Virtual Machine . Running This function obtains and installs the certificate into...
  • New-HttpVmEndpoint.ps1

    Function New - HttpVmEndpoint { < # SYNOPSIS This script defines a function to add an HTTP endpoint to an Azure VM . . DESCRIPTION This script uses the Azure module to change the VM instance size . . NOTES File Name : New - HttpVmEndpoint . ps1 Author : Thomas Lee - [email protected] . co . uk Requires : PowerShell Version 3.0 , Azure module Tested : PowerShell Version 5 . LINK This script posted to : http ...
  • AzureVM.Format.Ps1xml

    <!--    Description       This file contains display XML for the object returned from       Get-AzureVM. It's purpose is to provide better (default) output       from Get-AzureVm.    Written by       Thomas Lee ( [email protected]    Copyright:      PS Partnership 2015 --> <?xml version="1.0" encoding="utf-16"?> <Configuration>   <ViewDefinitions>     <View>       <Name>AzureVM</Name>       <ViewSelectedBy...
  • Measure-TypeAccelerator.ps1

    < # . SYNOPSIS This function 'measures' ( counts ) the number of Type Accelerators on your system . . DESCRIPTION This function counts the number of type accelerators are on your systems and returns that number . . NOTES File Name : Measure - TypeAccelerator . ps1 Author : Thomas Lee - [email protected] . co . uk Requires : Version 3 . LINK Script Repository http : //www.pshscripts.blogspot.com . Example Psh... Read…
  • Remove-TypeAccelerator

    < # . SYNOPSIS This script removes a type accelerator from your system . DESCRIPTION This script removes a NEW TA from your system . . NOTES File Name : Remove - TypeAccelerator . ps1 Author : Thomas Lee - [email protected] . co . uk Requires : Version 3 . LINK Script Repository http : //www.pshscripts.blogspot.com . Example Psh [ C : \foo ] > Remove - TypeAccelerator tfl Alias [ tfl ] removed # > ### # Start... Read the…
  • New-TypeAccelerator.ps1

    < # . SYNOPSIS This script creates a new type accelerator on your system . DESCRIPTION This script adds a NEW TA to your system . . NOTES File Name : New - TypeAccelerator . ps1 Author : Thomas Lee - [email protected] . co . uk Requires : Version 3 . LINK Script Repository http : //www.pshscripts.blogspot.com . Example Psh [ C : \foo ] > New - TypeAccelerator tfl system . int32 Alias [ tfl ] added for type ... Read the full…
  • Get-TypeAccelerator.ps1

    < # . SYNOPSIS This script defines a function to get a list of Type Accelerators in PowerShell and displays them nicely . DESCRIPTION This script gets the details of type accelerators in the system . Earlier versions of this script uses a different class , which has been taken private and is not available any more . This script also creates an alias for the function . GTA takes a string parameter which... Read the…
  • Get-Stack1.ps1

    < # . SYNOPSIS MSDN sample showing push and other stack processing using PowerShell . DESCRIPTION This script creates a script then performs stack operations . . NOTES File Name : Get - Stack1 . p1 Author : Thomas Lee - [email protected] . co . uk Requires : PowerShell V2 . LINK http : //www.pshscripts.blogspot.com . EXAMPLE PSH [ C : \foo ] : . \get - stack1 . ps1' Stack at start : fox quick The ( Pop ) fox... Read the…
  • Zip-Pshscripts3.ps1

    #Requires –Version 5.0 # # . Synopsis # Creates a zip file of PowerShell scripts # . Description # The script creates a zip file containing all the files , # recursing through the top level PowerShell Script Library folder . # # . Notes # This script require PowerShell V5 for the zip file cmdlets ! # Author - Thomas Lee - [email protected] . co . uk # # . Example # PS [ c : \foo ] > . \Zip - PSHScripts3 . ps1... Read the full…
  • Getting Shutdown Information

    All PowerShell Versions

    Windows logs all shutdown events in its System event log. From there, you can extract and analyze the information.

    Here is a function that looks for the appropriate event log entries, reads the relevant information from the ReplacementStrings array, and returns the shutdown information as objects.

    function Get-ShutdownInfo
    {
      
      Get-EventLog -LogName system -InstanceId 2147484722 -So…
  • Copying Command History...

    All PowerShell Versions

    If you played with PowerShell and suddenly realize that you would actually like to keep the commands you played with, try this simple one-liner:

    (Get-History).CommandLine | clip 
    

    It copies all commands from your command history to the clipboard. From there, you can paste all commands into your editor of choice, and save the commands to file.

    If you paste the commands into the PowerShell…

  • Searching Files with Regular Expressions

    All PowerShell Versions

    Get-ChildItem does not support advanced file filtering. While you can use simple wildcards, you cannot use regular expressions.

    To work around this, add a cmdlet filter and use the operator -match.

    This example will find all files within your Windows directory structure that have file names with at least 2-digit numbers in them, and a maximum file name length of 8 characters:

    Get-C…
  • Zip-Pshscripts.ps1

    < # . SYNOPSIS Creates a zip file from a folder structure and uploads it to an FTP site . . DESCRIPTION Creates a zip file of all the scripts in the script library , then uses system . net . webrequest to uploade it to a web site . Uses ICSharpCode . SharpZipLib . dll See http : //www.icsharpcode.net/OpenSource/SharpZipLib/ . NOTES File Name : zip - pshscripts . PS1 Author : Thomas Lee - [email protected] .... Read the full…
  • Show-Message.ps1

    < #   .SYNOPSIS      This script creates a function to display a message      in a message block, then demonstrates its usage  .DESCRIPTION      This script used Windows Forms to put up a message      box containing text and a window title passed as       parameters  .NOTES      File Name  : Show-Message.ps1      Author     : Thomas Lee - tfl @psp .co.uk      Requires   : PowerShell Version 3.0  .LINK...
  • Show-TimeSpanFormatting.ps1

    < #   .SYNOPSIS       This script demonstrates formatting System.TimeSpan objects      Using PowerShell   .DESCRIPTION       This script re-writes some MSDN Samples that demonstrate       timespan formatting - the original article lacks PowerShell      Examples. And sadly, the MSDN page no longer accepts community      additions.    .NOTES       File Name  : Show-Timespanformatting      Author    ...
  • Fix-FileName.ps1

    < #   .SYNOPSIS      Defines a function to remove 'invalid' characters      from a file name.  .DESCRIPTION      Some programs do not like certain 'invalid' characters      in a file name used by that application. The function       takes a look at each the file name and replaces some invalid      characters with '-' .        This function takes a file name and 'fixes' it and returns      the 'fixed...
  • Get-SQLServer2.ps1

    #Requires -Version 3.0   <#  .SYNOPSIS      This script Gets a list of SQL Severs on the Subnet  .DESCRIPTION      This script uses SMO to Find all the local SQL Servers       and displays them    .NOTES      File Name  : Get-SQLServer2.ps1      Author     : Thomas Lee - [email protected]      Requires   : PowerShell Version 3.0  .LINK      This script posted to:          http: //www.pshscripts.blogspot...
  • Get-OLCalendarItem

    Function Get-OLCalendarItem {      <#  .SYNOPSIS      A function to retreive Outlook Calender items between two dates.       Returns PSobjects containing each item.  .DESCRIPTION      The function opens one's outlook calender, then retrieves the items.       The function takes 2 parameter: start, end - items are returned that       start betweween these two dates.  .NOTES      File Name  : Get-OLCalendarItem...
  • Get-DHCPPerf.Ps1

    < #   .SYNOPSIS      This script gets and displays perf counters for DHCP  .DESCRIPTION      This script uses the Get-Counter cmdlet to get all      the counters for DHCP. The function does this for one      DHCP server at a time.  .NOTES      File Name  : Show-.ps1      Author     : Thomas Lee - tfl @psp .co.uk      Requires   : PowerShell Version 2.0  .LINK      This script posted to:          http...
  • Get-Zip.ps1

    < #   .SYNOPSIS      This script demonstrates the use of the Zip lib in .NET  .DESCRIPTION      This script is a re-write of an MSDN sample, using PowerShell  .NOTES      File Name  : Show-ZIP.ps1      Author     : Thomas Lee - tfl @psp .co.uk      Requires   : PowerShell Version 3.0  .LINK      This script posted to:          http://www.pshscripts.blogspot.com      MSDN sample posted to:         ...
  • Show-CurrencyGroupSeparator.ps1

    < #   .SYNOPSIS      This script demonstrates the use of the CurrencyGroupSeparator  .DESCRIPTION      This script is a re-write of an MSDN sample, using PowerShell  .NOTES      File Name  : Show-CurrencyGroupSeparator.ps1      Author     : Thomas Lee - tfl @psp .co.uk      Requires   : PowerShell Version 3.0  .LINK      This script posted to:          http://www.pshscripts.blogspot.com      MSDN sample...
  • Show-NumberGroupSeparator.ps1

    < #   .SYNOPSIS      This script demonstrates the use of the NumberGroupSeparator  .DESCRIPTION      This script is a re-write of an MSDN sample, using PowerShell  .NOTES      File Name  : Show-NumberGroupSeparator.ps1      Author     : Thomas Lee - tfl @psp .co.uk      Requires   : PowerShell Version 3.0  .LINK      This script posted to:          http://www.pshscripts.blogspot.com      MSDN sample...