This file contains hidden or 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
| #Requires -Version 5 | |
| <# | |
| .SYNOPSIS | |
| Converts powershell scripts to standalone executables. | |
| .DESCRIPTION | |
| Converts powershell scripts to standalone executables. GUI output and input is activated with one switch, | |
| real windows executables are generated. You may use the graphical front end Win-PS2EXE for convenience. | |
| Please see Remarks on project page for topics "GUI mode output formatting", "Config files", "Password security", |
This file contains hidden or 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 Compare-Array { | |
| [CmdletBinding()] | |
| [alias('Compare-Object2','Compare-ObjectFast')] | |
| param ( | |
| [Parameter(Position=0)] | |
| [psobject[]] $ReferenceObject, | |
| [Parameter(Position=1)] | |
| [psobject[]] $DifferenceObject, | |
| [switch] $IncludeEqual, | |
| [switch] $ExcludeDifferent |
This file contains hidden or 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
| <# | |
| Virtual multifunction via single function without additional parameters | |
| Get-FolderItem - list files | |
| Remove-FolderItem - delete files | |
| Copy-FolderItem - copy files | |
| Move-FolderItem - move files | |
| #> | |
| function Get-FolderItem { | |
| [cmdletbinding(DefaultParameterSetName='Filter')] | |
| [alias('Remove-FolderItem','Copy-FolderItem','Move-FolderItem')] #,'rfi','cfi','mfi','gfi' |
This file contains hidden or 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
| #Requires -Version 5 | |
| <# | |
| .SYNOPSIS | |
| Windows Software Licensing Management Tool | |
| .DESCRIPTION | |
| SLMGR PowerShell workshop/framework to explore Windows activation management. | |
| This is a ported slmgr.vbs script. | |
| .NOTES | |
| - Prerelease prototype |
This file contains hidden or 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 Test-FileLock ([string]$Path, [int]$TimeOutMs, [int]$Count) { | |
| $timeout = $TimeOutMs | |
| if ($timeout -lt 0) {$timeout = 0} | |
| if ($Count -gt 0) {$Count--} else {$Count = 0} | |
| do { | |
| try { | |
| $OFile = [System.IO.FileInfo]::new($Path) | |
| $OStream = $OFile.Open([System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None) | |
| if ($OStream) {$OStream.Close()} | |
| return $false |
This file contains hidden or 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
| # NOTE: XML doesn't take data types into account; it can be retrieved from event.Properties.Value, and the names can be taken from XML | |
| # NOTE: Event data without names can only be retrieved from event.Properties.Value | |
| function Convert-EventLog { | |
| [cmdletbinding()] | |
| [alias('cvev','Get-EventLogInfo')] | |
| param ( | |
| [Parameter(Position=0,Mandatory,ValueFromPipeline)] | |
| #[System.Diagnostics.Eventing.Reader.EventLogRecord[]] | |
| [alias('inputobject')]$EventObject, | |
| [switch]$noType, # return event data as text |
This file contains hidden or 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
| #Requires -RunAsAdministrator | |
| <# | |
| There are weird computers having physical netadapters without macaddress. | |
| This script finds faulty netadapters and assigns a random macaddress to the adapter | |
| #> | |
| Get-NetAdapter -Physical -ErrorAction 0 | Where-Object { | |
| $_.InterfaceDescription -notmatch 'Wireless|wi-fi|virt|Hyper-V' -and $_.MacAddress -eq '00-00-00-00-00-00' | |
| } | ForEach-Object { |
This file contains hidden or 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 test-remaining { | |
| [cmdletbinding()] | |
| param ( | |
| [parameter(ValueFromRemainingArguments)] | |
| $remaining | |
| ) | |
| $htRemaining = [ordered]@{} | |
| $unnamed = [System.Collections.Generic.list[object]]::new() | |
| $remaining | ForEach-Object { |
This file contains hidden or 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
| powershell.exe -executionpolicy bypass -noninteractive -nologo -noprofile -command "&{ If (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {write-warning 'You must run this script as an Administrator!'; cmd.exe /c pause; exit 1000} }" | |
| if ERRORLEVEL 1000 goto :EOF |
This file contains hidden or 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
| # But [datetime]::IsLeapYear is faster anyway | |
| function Test-IsLeap ([uint32]$year) { | |
| (($year * 1073750999) -band 3221352463) -le 126976 | |
| } |
NewerOlder