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
| using System.Diagnostics; | |
| using System.Runtime.InteropServices; | |
| using System.Security; | |
| using System.Security.Cryptography; | |
| using System.Text.RegularExpressions; | |
| namespace Encryption | |
| { | |
| public class Encryption //: IDisposable | |
| { |
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
| <# | |
| .SYNOPSIS | |
| Encrypt/decript strings. | |
| .DESCRIPTION | |
| AIO encryption dotsource mini-module. | |
| The module supports AES and DPAPI encryption methods. | |
| .FUNCTIONALITY | |
| Encryption method: Protect-String | |
| Decryption method: UnProtect-String | |
| Data method: Get-CipherData |
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
| <# | |
| .SYNOPSIS | |
| Removes comments and extra white space from an input PS script. | |
| .DESCRIPTION | |
| The filters omit white space and indented formatting in the output. Filters are comments, newlines, spaces, statement separator (;). | |
| .PARAMETER Path | |
| Specifies the path to the PS file to compress. | |
| .PARAMETER ScriptBlock | |
| Specifies the PowerShell scriptblock to compress. | |
| .PARAMETER NoTest |
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 | |
| # Insipred by and credits to PS2EXE by Markus Scholts (https://github.com/MScholtes/PS2EXE) | |
| <# | |
| .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", "Script variables" and "Window in background in -noConsole mode". |
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 { |
NewerOlder