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
# based on https://renenyffenegger.ch/notes/Windows/PowerShell/examples/WinAPI/ExtractIconEx | |
function Export-IconImageManifest { | |
param ( | |
[String]$DllPath = "$env:SYSTEMROOT\System32\imageres.dll" | |
) | |
if (! (test-path $dllPath)) { | |
write-output "$dllPath is not a file" | |
return | |
} |
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 AutoHotkey v2.0 | |
#SingleInstance | |
A_IconTip := "Change screen refresh rate" | |
; Based on an AHK v1 script from this Reddit post | |
; https://www.reddit.com/r/AutoHotkey/comments/qeqhfs/switch_refresh_rate_using_hotkeys/ | |
; Hotkey modifier symbols: #=Win, !=Alt, ^=Ctrl, +=Shift | |
; Find and set max supported refresh rate for primary monitor |
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 IpToInt ([ipaddress]$IPAddress) { | |
$IpBytes = $IPAddress.GetAddressBytes() | |
if ([BitConverter]::IsLittleEndian) { | |
[Array]::Reverse($IpBytes) | |
} | |
return [BitConverter]::ToUInt32($IpBytes, 0) | |
} |
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)][ValidateSet('Title', 'Department', 'Company')] | |
[string]$AttributeName = (Read-host -Prompt "Which attribute? [Title, Department, Company]"), | |
[Parameter(Mandatory = $true)][string]$AttributeValueOld = (Read-Host -Prompt "Old value"), | |
[Parameter(Mandatory = $true)][string]$AttributeValueNew = (Read-Host -Prompt "New value"), | |
[switch]$NoConfirm | |
) | |
begin {} |
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-UserCredential { | |
[CmdletBinding()] | |
[OutputType([bool])] | |
param ( | |
[pscredential]$Credential | |
) | |
begin { | |
if ($null -eq $Credential) { $Credential = Get-Credential } | |
$Domain = $Env:USERDOMAIN |
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
$ServerName = "CORP-DHCP01" | |
$ScopeId = "10.10.10.0" | |
$SubnetMask = "255.255.255.0" #This is the NEW mask that will be applied | |
$ServerFile = "c:\temp\dhcp_backup.xml" | |
$ServerFileBackup = "c:\temp\dhcp_backup2.xml" | |
$ScopeFile = "c:\temp\scope_$ScopeId.xml" | |
#backup entire server, just in case | |
Export-DhcpServer -ComputerName $ServerName -Leases -File $ServerFile | |
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
$target = read-host -p "Target" | |
$key = read-host -p "Key" | |
slmgr $target -ipk $key |
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
Get-ChildItem | Where-Object {$_.Name -like "* - *.wav"} | foreach { | |
Rename-Item $_ -NewName $_.Name.Substring(5) -whatif | |
} |
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
$target = read-host "Target" | |
$group = read-host "Group" | |
$user = read-host "User" | |
Invoke-Command -ComputerName $target -ScriptBlock { | |
net localgroup $(args[0]) $(args[1]) /add | |
#With PS5 | |
#Add-LocalGroupMember -Group $(args[0]) -Member $(args[1]) | |
} -ArgumentList $group,$user |
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
import getpass | |
import sys | |
import telnetlib | |
import os | |
# Variables | |
tacacs = '.tacacslogin' | |
commandsfile = 'commands.txt' | |
hostsfile = 'hosts.txt' | |
verbose = "yes" |
NewerOlder