Skip to content

Instantly share code, notes, and snippets.

View 1RedOne's full-sized avatar

Stephen Owen 1RedOne

View GitHub Profile
#ERASE ALL THIS AND PUT XAML BELOW between the @" "@
$inputXML = @"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Configuration Manager Content Import/Export" Height="564.345" Width="502.66">
Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.Rate = -10
1..5 | % {start-sleep -millisecond 500
$speak.Speak('SCROTUM')
}
@1RedOne
1RedOne / Find-LongFolderNames
Last active May 25, 2016 17:49
Find files longer than 260 chars
$files = New-Object System.Collections.ArrayList
$length = 100
$folder = 'J:\SLC\Anderson v. Gold Coast\Experts'
Function Show-FolderPickerDialog{
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$dialog = new-object System.Windows.Forms.FolderBrowserDialog
[void]$dialog.ShowDialog()
$dialog.SelectedPath
}
@1RedOne
1RedOne / DownloadEmAll.ps1
Created August 29, 2016 16:11
Download all files from a site in powerShell.ps1
<#
found this site which has all of the soundtrack to MH4 for free
BUT, you can't click downlaod and save each one, instead each link takes you to a new page with it's own DL link embedded within the site
Solution?
Wou write a short powershell script to find all the links we want, then load each page, find any downloadable MP3 links within that page and save them all
#>
$u = 'http://downloads.khinsider.com/game-soundtracks/album/monster-hunter-4'
@1RedOne
1RedOne / gist:9574256d0a78e6681919d7eb2eb6e1e2
Last active September 21, 2016 18:29
Figure out which values are which
$sampleSyntax = ((Get-DscResource User -Syntax).Split("`n") -join "`n")
{"
UserName = [string]
[DependsOn = [string[]]]
[Description = [string]]
[Disabled = [bool]]
[Ensure = [string]{ Absent | Present }]
[FullName = [string]]
[Password = [PSCredential]]
[PasswordChangeNotAllowed = [bool]]
@1RedOne
1RedOne / Update-CMClient.ps1
Created October 4, 2016 17:39
Automatic Client Upgrade
$code = 'Your Three digit site code'
while ($true){
$c= Get-CMCollection -Name 'Clients with < SCCM Version 1511' | select -expand MemberCount;
$d = Get-CMCollection -Name 'Clients with > SCCM Version 1511' | select -expand MemberCount;
$x = get-random -maximum 10 -minimum 1
"trying another $x clients"
$r = get-cmdevice -CollectionName 'Clients with < SCCM Version 1511' | get-random -count $x
$r | %{
Install-CMClient -DeviceName $_.Name -SiteCode $code -ForceReinstall $true -AlwaysInstallClient $True -IncludeDomainController $False
Loading Dump File [C:\temp\Microsoft.BDD.ElevatedProxy.exe_161007_122408.dmp]
User Mini Dump File with Full Memory: Only application data is available
Comment: '
*** procdump -ma -e -t -w microsoft.bdd.elevatedproxy.exe
*** Unhandled exception: E0434F4D.COM'
Symbol search path is: srv*
Executable search path is:
Windows 7 Version 7601 (Service Pack 1) MP (2 procs) Free x64
@1RedOne
1RedOne / Export-Overrides.ps1
Created October 10, 2016 20:40
Added a paramset to make the cmdlet easier to use, defaults to localhost now and provides feedback if can't connect
# ==============================================================================================
#
# NAME: OpsMgr Overrides Report
#
# ORGINAL AUTHOR: Daniele Muscetta and Pete Zerger
# ORGINAL DATE : 8/24/2010
#
# EDITED BY: Arjan Vroege
# EDITED DATA : 1/24/2014
#
@1RedOne
1RedOne / Show-Form.ps1
Created November 9, 2016 19:37
PowerShell GUI - Enable a tab after user input and validation
$logo = "$($env:temp)\FoxDeploy.png"
wget 'https://dl.dropboxusercontent.com/u/6268163/Foxdeploy_full.png' -OutFile $logo
#ERASE ALL THIS AND PUT XAML BELOW between the @" "@
$inputXML = @"
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@1RedOne
1RedOne / VMClass.ps1
Created November 22, 2016 21:26
VM Class example
#New-VM -Name "new 2" -MemoryStartupBytes 1GB
#-NewVHDPath d:\vhd\base.vhdx
Class VM
{
[string]$Name
[string]$MemoryStartupBytes = 4