Skip to content

Instantly share code, notes, and snippets.

View bobalob's full-sized avatar

Dave Hall bobalob

View GitHub Profile
@bobalob
bobalob / profile.ps1
Last active April 9, 2021 08:22 — forked from Dods80/profile.ps1
#Requires -Version 5
# Version 1.2.16
# check if newer version
$gistUrl = "https://api.github.com/gists/c35da09661305cf04fdfa15c0af7bb1a"
$latestVersionFile = [System.IO.Path]::Combine("$HOME",'.latest_profile_version')
$versionRegEx = "# Version (?<version>\d+\.\d+\.\d+)"
if ([System.IO.File]::Exists($latestVersionFile)) {
@bobalob
bobalob / network
Created October 12, 2020 19:59
new /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'auto'
option default_ps '0'
@bobalob
bobalob / network
Created October 12, 2020 19:58
original /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'auto'
option default_ps '0'
Param(
[Parameter(Mandatory=$true)]
[String]
$computerName,
[Int]
$maxEvents = 1000
)
$commands = @()
(Get-ADDomainController -Filter *).Hostname | Sort-Object -Unique | % { Invoke-Command -ComputerName $_ -ScriptBlock { New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\DNS\parameters -Name "TcpReceivePacketSize" -PropertyType DWord -Value 0xFF00 -Force ; Restart-Service DNS } ; Start-Sleep 30 ; Resolve-DNSName $_ -Server $_}
@bobalob
bobalob / appcompat.ps1
Last active July 22, 2019 10:23
Temporarily disable WSUS to install App Compatibility FOD in Server 2019
# Get current WSUS setting
$existingValue = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name UseWUServer).UseWUServer
# Disable WSUS
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' -Name UseWUServer -Value 0
# Restart WSUS
Restart-Service wuauserv
# Install the pack
function Get-ADTime {
Param(
[Switch]$IncludeUptime
)
$pdcName = Get-ADForest | Select-Object -ExpandProperty RootDomain | Get-ADDomain | Select-Object -ExpandProperty PDCEmulator
net time \\$pdcName /set /y
$outtab = @()
(Get-ADForest).GlobalCatalogs | sort | % {
$rawtime = w32tm /stripchart /computer:$_ /dataonly /samples:1 | Select -Last 1
Start-Transcript "$($ENV:Temp)\VMStart.Log"
$AzureUser = "youruser@yourdomain.onmicrosoft.com"
$EncodedPassword = "PASTE ENCODED PASSWORD HERE"
$SecureStringPwd = ConvertTo-SecureString $EncodedPassword
$AzureCredential = New-Object System.Management.Automation.PSCredential (
$AzureUser,
# Store the password in a SecureString
$Credential = Get-Credential -Message "Enter the Azure Account Password" -UserName "Anything"
$EncodedPassword = $Credential.Password | ConvertFrom-SecureString
$EncodedPassword
{
"schema": [
{
"mode": "rw",
"code": "led_switch",
"name": "开关",
"property": {
"type": "bool"
},
"iconname": "icon-dp_power",