Write-LogMessage Verbose -Message 'stuff' -Json @{ 'user' = 'bob'; id = 100 }
function New-SafeFileTimeNowString {
<#
.SYNOPSIS
timenow for safe filepaths: "2022-08-17_12-46-47Z"
.notes
# Prerequisites | |
- a machine with installed Windows, including the following tools: | |
I recommend to use chocolatey as a package manager: | |
```choco install -y cpu-z hwinfo furmark gpu-z prime95``` | |
- CPU-Z | |
- HWInfo | |
- Furmark | |
- GPU-Z | |
- Prime95 |
Write-LogMessage Verbose -Message 'stuff' -Json @{ 'user' = 'bob'; id = 100 }
function New-SafeFileTimeNowString {
<#
.SYNOPSIS
timenow for safe filepaths: "2022-08-17_12-46-47Z"
.notes
using System; | |
using System.Collections.Concurrent; | |
using System.Management.Automation; | |
using System.Threading; | |
using System.Threading.Tasks; | |
public abstract class AsyncPSCmdlet : PSCmdlet, IDisposable | |
{ | |
private enum PipelineType | |
{ |
$framework = 'netstandard2.0' | |
$folder = 'EventHubs' | |
$packages = 'Azure.Messaging.EventHubs', 'Azure.Messaging.EventHubs.Processor' | |
dotnet new classlib -f $framework -o "$folder.package" && | |
Push-Location "$folder.package" && | |
$packages | ForEach-Object { dotnet add package $_ } && | |
dotnet publish --configuration Release -o lib && | |
Add-Type -Path .\lib\*.dll && | |
Pop-Location |
using namespace System.Collections | |
class PSCustomObjectEquatable : IEquatable[object] { | |
hidden [object[]] $Properties | |
hidden [object[]] $Values | |
[object] $Instance | |
PSCustomObjectEquatable([object] $Instance) { | |
$psProperties = $Instance.PSObject.Properties | |
$this.Instance = $Instance |
$destination = 'path\to\destination' | |
$inFS = [System.IO.File]::OpenWrite($destination) | |
Get-ChildItem -Filter temp* | ForEach-Object { | |
$stream = $_.OpenRead() | |
$zip = [System.IO.Compression.ZipArchive]::new($stream, [System.IO.Compression.ZipArchiveMode]::Read) | |
$entry = $zip.GetEntry($_.Name) | |
$zipFS = $entry.Open() | |
$zipFS.CopyTo($inFS) | |
$zipFS, $zip, $stream | ForEach-Object Dispose |
using namespace System.Drawing | |
Add-Type -AssemblyName System.Drawing | |
function Resize-Picture { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] | |
[string] $SourcePath, |
<?xml version="1.0" encoding="UTF-16"?> | |
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | |
<RegistrationInfo> | |
<Date>2022-10-23T19:30:00.0000000</Date> | |
<Author>SCI\SpiralChaotic</Author> | |
<URI>\SCI\LightModeEnable</URI> | |
</RegistrationInfo> | |
<Triggers> | |
<CalendarTrigger> | |
<StartBoundary>2022-10-23T06:30:00</StartBoundary> |
<?xml version="1.0" encoding="UTF-16"?> | |
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | |
<RegistrationInfo> | |
<Date>2022-10-23T19:30:00.0000000</Date> | |
<Author>SCI\SpiralChaotic</Author> | |
<URI>\SCI\DarkModeEnable</URI> | |
</RegistrationInfo> | |
<Triggers> | |
<CalendarTrigger> | |
<StartBoundary>2022-10-23T18:30:00</StartBoundary> |
# This is not really good... if you want the real deal, check out: | |
# https://github.com/santisq/PSTree | |
function Get-DirectoryInfo { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ValueFromPipeline)] | |
[alias('FullName')] | |
[ValidateScript({ | |
if(Test-Path $_ -PathType Container) { | |
return $true |