Skip to content

Instantly share code, notes, and snippets.

Class AdhcResult {
[string]$Source
[string]$TestName
[bool]$Pass
$Was
$ShouldBe
[string]$Category
[string]$Message
$Data
[string[]]$Tags
function Enable-PSTranscription
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$false)]
[string]$OutputDirectory,
[Switch]$IncludeInvocationHeader
)
@gerane
gerane / wmi_provider_association.ps1
Created October 11, 2017 04:42 — forked from mattifestation/wmi_provider_association.ps1
Enumerates WMI providers, the DLLs that back the provider, and the classes hosted by the provider.
<#
Author: Matthew Graeber (@mattifestation)
License: BSD 3-Clause
#>
function Get-WmiNamespace {
[OutputType([String])]
Param (
[String]
[ValidateNotNullOrEmpty()]
This file has been truncated, but you can view the full file.
<#
.SYNOPSIS
Driver Automation GUI Tool for Dell,HP,Lenovo,Acer and Microsoft systems
.DESCRIPTION
This script allows you to automate the process of keeping your Dell, Lenovo
and HP drives packages up to date. The script reads the Dell, Lenovo and HP
SCCM driver pack site for models you have specified and then downloads
the corresponding latest driver packs and BIOS updates(Dell only).
.NOTES
FileName: DriverDownloadTool.ps1
if (((Test-Path -Path $Global:SettingsDirectory\DATSettings.xml) -eq $true) -and ($Global:DATSettingsXML.Settings.DownloadSettings.DeploymentPlatform -eq 'MDT'))
{
$ProgressListBox.ForeColor = "Black"
Write-CMLogEntry -Value "======== Detecting Deployment Platform $(Get-Date) ========" -Severity 1
Write-CMLogEntry -Value "======== Deployment Platform: MDT - Skipping SCCM Validation ========" -Severity 1
}
elseif (((Test-Path -Path $Global:SettingsDirectory\DATSettings.xml) -eq $true) -and (! [string]::IsNullOrEmpty($Global:DATSettingsXML.Settings.SiteSettings.Server)))
{
$SiteServer = [string]$SiteServerInput.Text
$ProgressListBox.ForeColor = "Black"
@gerane
gerane / Struct.ps1
Created May 8, 2017 10:57 — forked from proxb/Struct.ps1
Using PowerShell and Reflection to dynamically build a Struct with Constructors and Methods
#region Module Builder
$Domain = [AppDomain]::CurrentDomain
$DynAssembly = New-Object System.Reflection.AssemblyName(([guid]::NewGuid().ToString()))
$AssemblyBuilder = $Domain.DefineDynamicAssembly($DynAssembly, [System.Reflection.Emit.AssemblyBuilderAccess]::Run) # Only run in memory
$ModuleBuilder = $AssemblyBuilder.DefineDynamicModule(([guid]::NewGuid().ToString()), $False)
#endregion Module Builder
#region STRUCTs
#Order of creating these Structs is important
#region MyStruct
$Attributes = 'AutoLayout, AnsiClass, Class, Public, SequentialLayout, Sealed, BeforeFieldInit'
Register-EditorCommand `
-Name "Demo.Editors" `
-DisplayName "Editors Demo" `
-SuppressOutput `
-ScriptBlock {
param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context)
$SelectedText = $Context.CurrentFile.GetText($context.SelectedRange)
@gerane
gerane / Issue.md
Last active April 5, 2017 13:28
When

When executing the profile selection Editor Command and typing "profile.ps1" you have to double the letters because the first is sent to the console and the second is sent to the Prompt for Choice.

Fitst.log

Fitst.log is after typing "pprroofiillee..ppss11" I had deleted one of the "f" so that it wouldn't try to execute a profile.ps1 or soemthing like that. The log is after hitting enter the first time, which attempts to execute the "proile.ps1" that was sent to the console.

Second.log

Second.log is after hitting enter a second time, this time the Editor Command choice is executed

@gerane
gerane / tasks.json
Created March 17, 2017 14:53
Code Coverage VSCode Task
{
"version": "0.1.0",
"windows": {
"command": "${env.windir}\\sysnative\\windowspowershell\\v1.0\\PowerShell.exe"
},
"linux": {
"command": "/usr/bin/powershell"
},
"osx": {
"command": "/usr/local/bin/powershell"
@gerane
gerane / tasks.json
Last active March 13, 2017 16:10
Watcher Tasks
{
"version": "0.1.0",
"command": "${env.windir}\\sysnative\\windowspowershell\\v1.0\\PowerShell.exe",
"isShellCommand": true,
"showOutput": "always",
"args": [
"-NoProfile", "-ExecutionPolicy", "Bypass"
],
"tasks": [
{