This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
NIC Team default macaddress setter. | |
.DESCRIPTION | |
When using DHCP reservation for NIC teaming in Windows Server there is no way of determining which member interface becomes primary at boot. Because it is impossible to determine this, we do not know which member's MAC address will be used by the team. This makes DHCP troublesome. | |
#> | |
param ( | |
[alias('name')][string]$teamname, | |
[string]$macaddress, | |
[alias('apply')][switch]$run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
VMware Tools Remover | |
.DESCRIPTION | |
This script will automatically rip out all VMware Tools registry entries, | |
files, drivers, DLLs, and services for Windows 7-11, 2008-2022. | |
Features: | |
- View/Action modes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compress-range ([int[]]$inputobject, [switch]$sort, [switch]$unique) { | |
if (-not $inputobject.count) {return} | |
$first = $true | |
$range = $inputobject[0],$inputobject[0] | |
$param = @{} | |
if ($unique) {$param['unique'] = $true} | |
$sb = if ($sort) {{$inputobject | Sort-Object @param}} else {{$inputobject}} | |
foreach ($e in (.$sb)) { | |
$diff = [math]::Abs($e - $range[1]) | |
if ($diff -eq 1) {$range[1]++} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.nuget.org/packages/itextsharp/ (5.5.13.3) | |
# https://github.com/itext/itextsharp/releases/tag/5.5.13 | |
Add-Type -Path "$psscriptroot\itextsharp.dll" # 5.5.13 and lower have no dependencies | |
function Read-Pdf { | |
[CmdLetBinding(DefaultParameterSetName="Path")] | |
param ( | |
[Parameter(ParameterSetName="Path", Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName, Position=0)] | |
[alias('fullname')][string[]]$path, | |
[Parameter(ParameterSetName="Instance", Position=0)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Join-String { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline)]$Inputobject, | |
[string]$Property, [string]$Separator='', | |
[string]$OutputPrefix, [string]$OutputSuffix, | |
[switch]$SingleQuote, [switch]$DouleQuote, | |
[string]$FormatString | |
) | |
begin { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Reads data from Excel file into PowerShell object. | |
.DESCRIPTION | |
Uses OLEDB provider to execute a SQL statement against a XLSX file to read data. This cmdlet assumes a file path will be passed in and treating all results as text. | |
Features: | |
* Can read entire workbook | |
* Can get workbook sheet names | |
* Parameterized query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function PSQUser { | |
param ( | |
[alias('inputobject','server','srv','ipaddress')] | |
[string[]]$computerName = 'localhost' | |
) | |
$quserPattern = @( | |
'(?<UserName>>?\S+)' | |
'(?<SessionName>(\w+)?)' | |
'(?<Id>\d+)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Event ID Meaning | |
00 The log was started. | |
01 The log was stopped. | |
02 The log was temporarily paused due to low disk space. | |
10 A new IP address was leased to a client. | |
11 A lease was renewed by a client. | |
12 A lease was released by a client. | |
13 An IP address was found to be in use on the network. | |
14 A lease request could not be satisfied because the scope's address pool was exhausted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
$step < 0 - left shift | |
$step = 0 - reverse | |
$step > 0 - right shift | |
#> | |
function Shift-Array { | |
[cmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline)] | |
$Inputobject, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Creates HTML table from .NET objects. | |
.DESCRIPTION | |
This is basic cmdlet, as a helper, to build HTML tables for complex HTML content. | |
Converts .NET objects into HTML that can be displayed in a Web browser. | |
This cmdlet works like "ConvertTo-Html -Fragment" but does not have any of its disadvantages, allowing HTML entities in cells, omiting the first column colons and allowing multi-column tables in the List mode, etc. | |
Features: | |
- Parameterset autoresolve. There are no predefined parameter sets | |
- Input data preprocessor: sorting and filtering |
NewerOlder