Skip to content

Some PowerShell scipts that can be hopefully also useful to others. Most of them were written by me, if not I tried to reference the author and or source. Since I collected those scripts over several years, I couldn't always remember though.

License

Notifications You must be signed in to change notification settings

DBremen/PowerShellScripts

Repository files navigation

PowerShellScripts

Some PowerShell scipts that can be hopefully also useful to others. Most of them were written by me, if not I tried to reference the author and or source. Since I collected those scripts over several years, I couldn't always remember though.

Function Location Synopsis Related Blog Post Full Documentation
Diff-CSV Binary wrapper\Diff-CSV.ps1 PowerShell wrapper for diff-table.exe a tool to diff csv files Link
Diff-Excel Binary wrapper\Diff-Excel.ps1 PowerShell wrapper for ExcelConmpare a tool to diff excel files Link
Get-ESSearchResult Binary wrapper\Get-ESSearchResult.ps1 PowerShell wrapper around Everything search command line (es.exe). Link Link
SilverSearcher Binary wrapper\SilverSearcher.ps1 PowerShell wrapper around silver searcher (ag.exe) Recursively search for PATTERN in PATH. Like grep or ack, but faster. Link
Add-LookupColumn Data Wrangling\Add-LookupColumn.ps1 Funciton to use Excel's vlookup through PowerShell. Requires Excel to be installed. Link
Convert-CsvToXls Data Wrangling\Convert-CsvToXls.ps1 Convert a .csv file to xlsx (despite the name) Link
ConvertFrom-NamedCaptureGroup Data Wrangling\ConvertFrom-NamedCaptureGroup.ps1 Convert the output of a RegEx named capture group to a PSObject Link
Get-ChangeLog Data Wrangling\Get-ChangeLog.ps1 Comparing two objects or .csv files column by column. Link Link
Get-CSVDelimiter Data Wrangling\Get-CSVDelimiter.ps1 Autodetects delimiter used in CSV files and number of rows Link
Get-LineNumber Data Wrangling\Get-LineNumber.ps1 Retrieve specific Linenumber(s) from afile. Link
Get-TextWithin Data Wrangling\Get-TextWithin.ps1 Get the text between two surrounding characters (e.g. brackets, quotes, or custom characters) Link Link
grep Data Wrangling\grep.ps1 Filter output based on keyword, but still retain PowerShell object format. Hence it can be even used in the middle of a pipeline (see example): Link
Group-ConsecutiveRanges Data Wrangling\Group-ConsecutiveRanges.ps1 Given an integer array with numbers, return groups of consecutive ranges. Link
Import-Excel Data Wrangling\Import-Excel.ps1 Import data from Excel using Excel's COM interface. Link
Join-CSV Data Wrangling\Join-CSV.ps1 Function to join two .csv files based on a common column. Based on a PowerShellMagazine article from Chrissy LeMaire (see link). Link
Join-Linq Data Wrangling\Join-Linq.ps1 Performs an inner join of two object arrays based on a common column. Link
Query-Csv Data Wrangling\Query-Csv.ps1 Function to retrieve data from a .csv file based on sql query. Based on a PowerShellMagazine article from Chrissy LeMaire (see link). Link
Sort-CustomList Data Wrangling\Sort-CustomList.ps1 Sort data using a custom list in PowerShell. Link Link
Update-Content Data Wrangling\Update-Content.ps1 Insert text on a new line after the line matching the StartPattern or replace text between start- and end Pattern within a file Link
Compare-File Extend Builtin\Compare-File.ps1 A wrapper and extension for the built-in Compare-Object cmdlet to compare two txt based files and receive a side-by-side comparison (including Line numbes). Link
Compare-Object Extend Builtin\Compare-Object.ps1 Proxy function for the built-in Compare-Object cmdlet. This version also works with arrays, arrays of PSCustomObjects and custom classes it iterates over nested objects and properties to compare their values and also support compact output. See description and paramenter help for more. Compares two sets of objects. Link Link
Get-Choice Extend Builtin\Get-Choice.ps1 An alternative to the built-in PromptForChoice providing a consistent UI across different hosts. Link Link
Get-HelpExamples Extend Builtin\Get-HelpExamples.ps1 Get examples for a Cmdlet. Link
Get-HelpSyntax Extend Builtin\Get-HelpSyntax.ps1 Get the syntax for a cmdlet pretty printed + explanation Link Link
Get-Range Extend Builtin\Get-Range.ps1 Function to retrieve a continuous or stepwise Range of integers,decimals,dates,month names, day names or chars. Simulating Haskell`s Range operator Link Link
Join-Tables Extend Builtin\Join-Tables.ps1 Function to join tables based on one or more common columns with an option to summarize (aggregate) joined columns. Link
Select-ObjectX Extend Builtin\Simplified-Select.ps1 Proxy function for Select-Object providing easier syntax for calculated properties. Link Link
WhereEx Extend Builtin\WhereEx.ps1 POC for a simplified Where-Object with multiple conditions on the same property for PowerShell. Link Link
Add-FormatTableView format output\Add-FormatTableView.ps1 Function to add a Format Table View for a type Link Link
Add-PropertySet format output\Add-PropertySet.ps1 Function to create property sets Link Link
ConvertTo-HtmlConditionalFormat format output\ConvertTo-HtmlConditionalFormat.ps1 Function to convert PowerShell objects into an HTML table with the option to format individual table cells based on property values using CSS selectors. Link
Format-Error format output\Format-Error.ps1 Format $error[x] output. Link
Format-Pattern format output\Format-Pattern.ps1 Highlight a pattern in the output. Cannot be used in the middle of a pipeline. And works only on the commandline. Link
Get-FormatView format output\Get-FormatView.ps1 Function to get the format views for a particular type. Link Link
Out-ConditionalColor format output\Out-ConditionalColor.ps1 Filter to conditionally format PowerShell output within the PowerShell console. Link
Out-ConditionalColorProperties format output\Out-ConditionalColorProperties.ps1 Filter to conditionally format property values within PowerShell output on the console. Link
Out-Diff format output\Out-Diff.ps1 Generate html diff from git diff output using diff2html. Link
Get-ACEData ACE\ACE.psm1 Checkout the whole modules as it exports several more functions. Queries Excel and Access files. Link
Clear-Clipboard Clear-Clipboard\Clear-Clipboard.psm1 Identify the process that currently blocks the clipboard (Using GetOpenClipboardWindow and GetWindowThreadProcessId API calls) Opens a small GUI offering options to either stop or restart the process Link Link
Get-LegacyHelp Get-LegacyHelp\Get-LegacyHelp.psm1 Display help for windows commandline commands Link Link
Start-Logging Logging\Logging.psm1 Module to provide a logging functionality for scripts originally written by Oisin Grehan see link. Link
8Queens programming exercises\8 Queens.ps1 PowerShell solution for a classical programming exercise. Link
Confirm-Brackets programming exercises\Confirm-Brackets.ps1 Function to check and display (through indentation) pairing of braces, brackets, and parentheses '{[()]} Link
GenerateSolveMaze programming exercises\GenerateSolveMaze.ps1 Function to generate a GUI (Windows forms) to build and solve random mazes Link
Get-CartesianProduct programming exercises\Get-CartesianProduct.ps1 Get the cartesian product for an object that contains array properties. See example. Link
TowerOfHanoi programming exercises\TowerOfHanoi.ps1 PowerShell solution to the Tower of Hanoi problem (http://en.wikipedia.org/wiki/Tower_of_Hanoi) using recursion. Link
Add-PowerShellContextMenu Utils\Add-PowerShellContextMenu.ps1 Function to create context menu entries in order to invoke PowerShell Link Link
Add-ScriptHelpISEAddOn Utils\Add-ScriptHelpISEAddOn.ps1 Function to create an ISE Add-On that will generate comment based help for functions. The functions requires the Show-UI module. Link Link
ConvertFrom-ExcelClipboard Utils\ConvertFrom-ExcelClipboard.ps1 Convert copied range from excel to an array of PSObjects Link Link
ConvertFrom-HtmlToText Utils\ConvertFrom-HtmlToText.ps1 Extract the text out of a HTML string Link
ConvertTo-Localtime Utils\ConvertTo-LocalTime.ps1 Convert a datetime from a remote timezone to the local time. Link Link
ConvertTo-PSFunction Utils\ConvertTo-PSFunction.ps1 Function to "convert" legacy command line commands to PowerShell functions Link
Delete-ComputerRestorePoint Utils\Delete-ComputerRestorePoint.ps1 Function to Delete Windows System Restore points Link
ForeachFor2 Utils\ForeachFor2.ps1 Function to step through two series of values in two collections and run commands against them. Link
Get-Breaktimer Utils\Get-Breaktimer.ps1 Function to display a break timer with a countdown based on absolute or relative times. Link
Get-Field Utils\Get-Field.ps1 Gets the public and private fields of objects. Link
Get-FileAndExtract Utils\Get-FileAndExtract.ps1 Function to download and extract files. Link
Get-FileEncoding Utils\Get-FileEncoding.ps1 Get the file encoding of a given file. Link
Get-FormatStrings Utils\Get-FormatStrings.ps1 Show common format strings for a given input and the respective outputs Link Link
Get-GoogleSuggestion Utils\Get-GoogleSuggestion.ps1 Function to get "Did you mean?" suggestions from Google. Link
Get-MSDNInfo Utils\Get-MSDNInfo.ps1 Opens the MSDN web page of an object member: type, method or property. Link
Get-OutlookSentItems Utils\Get-OutlookSentItems.ps1 Get emails in "Sent Items" Link
Get-OutputProducingCommand Utils\Get-OutputProducingCommand.ps1 Get the line(s) of code that produce an output from a function or script. Link
Get-ParamInfo Utils\Get-ParamInfo.ps1 Retrieve extensive parameter information about a cmdlet Link
Get-Uninstaller Utils\Get-Uninstaller.ps1 Function to get the uninstaller for installed software via registry (PowerShell v4 and <) or Get-Package) Link Link
Get-WIFIPassword Utils\Get-WIFIPassword.ps1 Get the Wifi password of stored networks using netsh. Link
Invoke-ContextMenuAction Utils\Invoke-ContextMenuAction.ps1 List or permforms verb actions on file system objects that show up in the context menu. Link
Invoke-HTMLPesterReport Utils\Invoke-HTMLPesterReport.ps1 Generate HTML report for Pester test results using ReportUnit.exe Link Link
Invoke-LegacyCommand Utils\Invoke-LegacyCommand.ps1 Helper to invoke legacy command with switches from PowerShell in a convenient way. Also supports pipeline input to invoke the command with arguments multiple times. Link
Invoke-Parallel Utils\Invoke-Parallel.ps1 Execute a scriptblock in parallel using runspaces taking pipeline input. Link
Invoke-Parser Utils\Invoke-Parser.ps1 Uses PowerShell's parser and returns the AST, Tokens and Errors Link
Migrate-ScheduledTask Utils\Migrate-ScheduledTask.ps1 Script to migrate scheduled tasks from Windows XP/Server 2003 to Windows 7/Server 2008 task scheduler Link
Monitor-Folder Utils\Monitor-Folder.ps1 Monitors a folder for changes using non-persistent asynchronous events Link
New-PSObject Utils\New-PSObject.ps1 Helper function to create PSCustomObjects based on array of names and array of properties. Link
Open-Registry Utils\Open-Registry.ps1 Open the regedit at the specified path similar to sysinternals regjump. Link
Restart-Process Utils\Restart-Process.ps1 Function to restart process(es) Link Link
Set-IPAddress Utils\Set-IPAddress.ps1 Set a network interfacres IPv4 address (hard coded 24bit mask) either dynamic or static including DNS settings. Link
Start-ProcessUnelevated Utils\Start-ProcessUnelevated.ps1 Function to start a process unelevated from an elevated command prompt Link
Generate-ScriptMarkdownHelp PowerShellScripts\Generate-ScriptMarkdownHelp.ps1 The function that generated the Markdown help in this repository. (see Example for usage). Generates markdown help for Github for each function containing comment based help (Description not empty) within a folder recursively and a summary table for the main README.md Link
Get-FunctionFromScript PowerShellScripts\Generate-ScriptMarkdownHelp.ps1 Gets the functions and filters declared within a script block or a file Link

About

Some PowerShell scipts that can be hopefully also useful to others. Most of them were written by me, if not I tried to reference the author and or source. Since I collected those scripts over several years, I couldn't always remember though.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •