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 Get-AlphaRange([string]$Range) | |
{ | |
$Alphabet = @('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') | |
$AlphabetIndex = @{'a' = 0 ;'b' = 1 ;'c' = 2 ;'d' = 3 ;'e' = 4 ;'f' = 5 ;'g' = 6 ;'h' = 7 ;'i' = 8 ;'j' = 9 ;'k' = 10 ;'l' = 11 ;'m' = 12 ;'n' = 13 ;'o' = 14 ;'p' = 15 ;'q' = 16 ;'r' = 17 ;'s' = 18 ;'t' = 19 ;'u' = 20 ;'v' = 21 ;'w' = 22 ;'x' = 23 ;'y' = 24 ;'z' = 25} | |
if ($Range -match '[a-z]\.{2}[a-z]') | |
{ | |
$RangeStart = $AlphabetIndex[$Range.split('..')[0]] | |
$RangeEnd = $AlphabetIndex[$Range.split('..')[2]] | |
if ($RangeStart -lt $RangeEnd) |
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 New-SparseFile | |
{ | |
param( | |
[string]$filepath, | |
[long]$sizeInBytes, | |
[switch]$passthrough | |
) | |
if (test-path $filepath) | |
{ | |
throw "File '$filepath' already exists." |
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 Touch-File | |
{ | |
param( | |
[Parameter(Mandatory=$True)] | |
$Path | |
) | |
if(Test-Path $Path) | |
{ | |
Set-ItemProperty -Path $Path -Name LastWriteTime -Value $(get-date) -PassThru | Get-Item | |
} |
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 New-FolderWatcher | |
{ | |
param( | |
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)] | |
$Path, | |
[Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$True)] | |
[hashtable] $Events , | |
[Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$True)] | |
$MessageData = "", | |
[Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$True)] |
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 Get-SCCMSiteMode($ComputerName) | |
{ | |
if ( $(Get-Service -Name CcmExec -ComputerName $ComputerName -ErrorAction SilentlyContinue) ) | |
{ | |
try { $CCM_ClientSiteMode = Get-WmiObject -Namespace 'ROOT\ccm' CCM_ClientSiteMode -ComputerName $ComputerName -EA SilentlyContinue } | |
catch { $CCM_ClientSiteMode = $NULL} | |
if ($CCM_ClientSiteMode) | |
{ |
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
Invoke-WmiMethod -ComputerName $ComputerName -Path win32_process -Name create -ArgumentList "gpupdate /target:Computer /force" |
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 Repair-SCCMHttpStatus($ComputerName,$DesiredHttpsState = 0x0000005f) | |
{ | |
$WhatIf = $false | |
$HTTPSStates = @{ | |
'0' = 'Mixed mode' | |
'31' = 'Native mode' | |
'63' = 'Native mode, CRL' | |
'95' = 'Native mode, FALLBACK' | |
'127' = 'Native mode, CRLANDFALLBACK' |
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 Repair-RemoteRegistryService($ComputerName) | |
{ | |
# Tries to Start the Remote Registry Service, and returns true or false if it is running. | |
Get-Service -ComputerName $ComputerName -Name RemoteRegistry -ErrorAction SilentlyContinue | Start-Service -ErrorAction SilentlyContinue | |
$RemoteRegistrySvc = Get-Service -ComputerName $ComputerName -Name RemoteRegistry -ErrorAction SilentlyContinue | |
If ($RemoteRegistrySvc.Status -eq 'Running') { $true } | |
else | |
{ | |
$false |
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
$LOCAL_ADMINISTRATORS = [System.Security.Principal.NTAccount] "Administrators" | |
$FS_RIGHT_LIST = 'ListDirectory, Traverse' | |
$FS_RIGHT_READ = 'Read' | |
$FS_RIGHT_MODIFY = 'Modify' | |
$FS_RIGHT_CREATE = 'CreateFiles, CreateDirectories' | |
$This_Folder_Subfolders_Files = @('ContainerInherit, ObjectInherit', 'none') | |
$Subfolders_Files_Only = @('ContainerInherit, ObjectInherit', 'InheritOnly') | |
$Subfolders_Only = @('ContainerInherit', 'InheritOnly') |
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
@ECHO OFF | |
SET SCRIPTPATH=%~dp0 | |
setlocal ENABLEDELAYEDEXPANSION | |
:: ElevationCheck TODO: ADD OS Check/Disable for 2003 | |
::whoami /groups | find "S-1-16-12288" > nul | |
::if "%errorlevel%"=="0" ( | |
:: echo Running as elevated user. Continuing script. | |
:: echo. | |
::) else ( |
OlderNewer