Skip to content

Instantly share code, notes, and snippets.

@sowderca
sowderca / init.ps1
Last active March 22, 2023 16:14
Init for scale set
[ScriptBlock] $bootstrap = {
[string] $localhost = [Environment]::MachineName;
[string] $controller = Get-BBGuestSiteComputerNames -BBResourceType 'CitrixXenAppDeliveryController' | Select-Object -First 1;
Copy-BBGuestGen7DatabaseRegistryEntries -DestinationComputerName $localhost -SourceComputerName (
Get-BBGuestSiteComputerNames -BBResourceType 'CitrixXenAppDeliveryAgent' -Application 'Queue'
);
Add-BBGuestCitrixVDAtoMachineCatalog -ComputerName $localhost -SiteController $controller -CitrixMachineCatalogName (
Get-BBGuestCitrixMachineCatalogName -DeliveryControllerInstance 1
rem run to bypass windows upgrades without TPM
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\vdsldr.exe" /f
:: ONLY IF ABOVE ERRORS
rem run if the previous cmd does not fix the error
wmic /namespace:"\\root\subscription" path __EventFilter where Name="Skip TPM Check on Dynamic Update" delete
<wsdl:definitions
targetNamespace="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
xmlns:cfg="http://schemas.microsoft.com/wbem/wsman/1/config"
xmlns:wsmanfault="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault"
xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wst="http://schemas.xmlsoap.org/ws/2004/09/transfer"
xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
@sowderca
sowderca / gist:83c8e44434a2d9dea33eef96fb4a0b76
Created January 18, 2022 20:29
Exclude based upon attribute
Get-ChildItem -Path './src' -Filter '*.ps1' -File -Recurse | ForEach-Object {
$functions = (Get-Command $_.FullName).ScriptBlock.Ast.FindAll( { $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] }, $false);
foreach ($func in $functions) {
[ScriptBlock] $code = [ScriptBlock]::Create("function tmp-$($func.Name) $($func.Body)");
New-Module -Name 'tmp-mod' -ScriptBlock $code | Out-Null;
[PSCustomObject] @{
File = $_.Name;
Function = $func.Name;
Attributes = (Get-Command -Name "tmp-$($func.Name)").ScriptBlock.Attributes | % { ${PSItem}?.TypeId?.Name }
};
Code:
init:
#NoEnv
#SingleInstance, Force
#Persistent
#InstallKeybdHook
#UseHook
#KeyHistory, 0
#HotKeyInterval 1
#MaxHotkeysPerInterval 127
@sowderca
sowderca / script.ps1
Created May 17, 2021 21:14
local admins
Get-CimInstance -ComputerName $ComputerName -Namespace 'root/cimv2' -QueryDialect 'WQL' -Query "associators of {Win32_Group.Domain='$($ComputerName)',Name='Administrators'} where Role=GroupComponent";
@sowderca
sowderca / script.ps1
Last active March 5, 2021 18:28
flat directory file dependency solution
#!/usr/bin/env pwsh
#Requires -Version 7
param([string] $path);
Push-Location -Path $path;
function order([string] $Path) {
[Collections.Stack] $stack = [Collections.Stack]::new();
foreach ($file in (Get-ChildItem -Path $Path -Filter '*.txt')) {
[void] $stack.Push($file.Name);
$file | Get-Content | ForEach-Object {
[string]::IsNullOrEmpty($_) ? (&{return}) : (order($_));
#!/usr/bin/env pwsh
using namespace System;
[CmdletBinding()]
param(
[string] $ModuleName = $env:MODULE_NAME,
[string[]] $RequiredModules = $env:REQUIRED_MODULES,
[string] $BuildVersion = $env:BUILD_VERSION
);
@sowderca
sowderca / run.ps1
Created November 17, 2020 16:51
uni test helper
#!/usr/bin/env pwsh
#Requires -Version 5.0
#Requires -Module Pester, Microsoft.PowerShell.Management, Microsoft.PowerShell.Utility
using namespace System;
using namespace System.IO;
[CmdletBinding()]
param(
@sowderca
sowderca / ssb-interop.bundle.js
Created July 18, 2019 13:08
/Applications/Slack.app/Contents/Resources/app/dist/
This file has been truncated, but you can view the full file.
module.exports = function(modules) {
var installedModules = {};
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) return installedModules[moduleId].exports;
var module = installedModules[moduleId] = {
i: moduleId,
l: !1,
exports: {}