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
| $out = @{} | |
| $cpus = Get-CimInstance win32_processor -Property Name,NumberOfCores,MaxClockSpeed,NumberOfEnabledCore | |
| $hyperThreadEnabled = $cpus[0].NumberOfCores -ne $cpus[0].NumberOfEnabledCore | |
| $out.Compute = @{ | |
| Name = $cpus[0].Name | |
| Cores = $cpus[0].NumberOfCores | |
| MaxClockSpeedMHz = $cpus[0].MaxClockSpeed | |
| HyperThreadingEnabled = $hyperThreadEnabled | |
| Count = $cpus.Count |
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
| { | |
| "$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json", | |
| "type": "Microsoft.DSC.Inventory/Hardware", | |
| "description": "Retrieve hardware information", | |
| "version": "0.1.0", | |
| "get": { | |
| "executable": "pwsh", | |
| "args": [ | |
| "-NoLogo", | |
| "-NonInteractive", |
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
| param( | |
| [parameter()] | |
| [string] | |
| $org = 'PowerShell' | |
| ) | |
| # PowerShell Team members | |
| $exclude = @( | |
| 'adityapatwardhan' | |
| 'alerickson' |
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
| param( | |
| [parameter(Mandatory)] | |
| $user, | |
| [System.Management.Automation.SwitchParameter] | |
| $delete, | |
| [string] | |
| $yourUsername, |
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 Get-SuspiciousElement { | |
| param ( [scriptblock]$sb, [switch]$InPlace ) | |
| $susProp = $sb.ast.gettype().GetProperty("HasSuspiciousContent", [reflection.bindingflags]"NonPublic,Instance") | |
| $suspiciousContent = "" | |
| $sb.Ast.FindAll({$true}, $true) | %{ | |
| if ( $susProp.GetValue($_) ) { | |
| $suspiciousContent = $_.Extent.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
| $ExecutionContext.InvokeCommand.CommandNotFoundAction = | |
| { | |
| param( | |
| [string] | |
| $commandName, | |
| [System.Management.Automation.CommandLookupEventArgs] | |
| $eventArgs | |
| ) | |
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
| param( | |
| [string]$include = "*.resx" | |
| ) | |
| $filesToExclude = @( | |
| 'FlashExtractStrings.resx' | |
| '*Xaml*.resx' | |
| 'TabCompletionStrings.resx' | |
| '*UICultureResources.resx' | |
| 'ComputerResources.resx' |
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
| write-progress -id 1 -Activity "Getting all modules" | |
| $modules = find-module -Repository PSGallery | |
| $moduleNames = $modules.Name | |
| $fz = [System.Reflection.Assembly]::GetAssembly([System.Management.Automation.PowerShell]).GetType("System.Management.Automation.FuzzyMatcher") | |
| $fzmatch = $fz.GetMethod("GetDamerauLevenshteinDistance") | |
| $fzmatches = @{} | |
| $i = 1 | |
| foreach ($module in $moduleNames) { | |
| write-progress -id 1 -Activity "Searching" -Status "$module" -PercentComplete ([int32]([double]$i / [double]($moduleNames.Count) * 100)) |
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
| [cmdletbinding()] | |
| param( | |
| [Parameter(Mandatory=$true,Position=0)] | |
| [string]$command, | |
| [Parameter(Position=1)] | |
| [string]$class | |
| ) | |
| if ($command -eq 'path') { |
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; | |
| using System.Management.Automation; | |
| using System.Text; | |
| namespace ClipboardReverse | |
| { | |
| [Cmdlet(VerbsCommon.Get,"ClipboardReverse")] | |
| [OutputType(typeof(string))] | |
| public class ClipboardReverse : PSCmdlet | |
| { |
NewerOlder