This file contains 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
using namespace System.Management.Automation | |
using namespace System.Management.Automation.Language | |
if ($host.Name -eq 'ConsoleHost') | |
{ | |
Import-Module PSReadLine | |
} | |
oh-my-posh --init --shell pwsh --config "C:\Users\$env:userName\AppData\Local\Programs\oh-my-posh\themes\wylde.omp.json" | Invoke-Expression |
This file contains 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
## set the path to the xml xccdf file. | |
$BenchMarkFilePath = '~\Documents\U_Windows_2012_and_2012_R2_MS_STIG_V2R6_Manual-xccdf.xml' | |
## load the content as XML | |
[xml]$Stigx = Get-Content -Path $BenchMarkFilePath -EA Stop | |
# start by parsing the xccdf security benchmark | |
if($Stigx){ | |
$StigCollection = @() | |
# loop through the xccdf benchmark collecting data into an object collection | |
foreach ($rule in $StigX.Benchmark.Group.Rule){ |
This file contains 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 -Version 3.0 | |
# This is a simple sample for access the MS UIAutomation in PowerShell. | |
# In this sample: | |
# 1. Load the MS UIA via System.Reflection.Assembly | |
# 2. Launch the AUT ( calc.exe ) | |
# 3. Find the AutomationElement via the AUT Process Id | |
# 4. Find buttons via 'ClassName' and 'Name' property | |
# 5. Click the '1', '+', '1', '=' buttons. | |
# At last, we will get '2' in the result of calc App. |
This file contains 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
# | |
# Working with branches | |
# | |
# Get the current branch name (not so useful in itself, but used in | |
# other aliases) | |
branch-name = "!git rev-parse --abbrev-ref HEAD" | |
# Push the current branch to the remote "origin", and set it to track | |
# the upstream branch | |
publish = "!git push -u origin $(git branch-name)" |
This file contains 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
using namespace System.Collections.Generic | |
# Encapsulate an arbitrary command | |
class PaneCommand { | |
[string]$Command | |
PaneCommand() { | |
$this.Command = ""; | |
} |
This file contains 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
# From https://technet.microsoft.com/en-us/library/ff730944.aspx | |
# This will open an internet explorer window that will display all installed windows font names in their corresponding font. | |
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | |
$objFonts = New-Object System.Drawing.Text.InstalledFontCollection | |
$colFonts = $objFonts.Families | |
$objIE = New-Object -com "InternetExplorer.Application" | |
$objIE.Navigate("about:blank") | |
$objIE.ToolBar = 0 |
This file contains 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 -version 7.2 | |
<# | |
These commands can be used to export FileInfo settings from $PSStyle and | |
then import them in another session. You might use the import command in | |
your PowerShell profile script. The file must be a json file. | |
#> | |
Function Export-PSStyleFileInfo { | |
[cmdletbinding(SupportsShouldProcess)] | |
Param( |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Management.Automation.Language; | |
public class ScriptExtent : IScriptExtent | |
{ | |
private readonly IScriptPosition _start; | |
private readonly IScriptPosition _end; |
This file contains 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
primary: | |
background: '#181818' | |
foreground: '#C7C7C7' | |
normal: | |
black: '#000000' | |
red: '#CD3131' | |
green: '#0DBC79' | |
yellow: '#E5E510' | |
blue: '#2472C8' | |
magenta: '#BC3FBC' |
This file contains 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
<# | |
.SYNOPSIS | |
Replace tokens in a file with values. | |
.DESCRIPTION | |
Finds tokens in a given file and replace them with values. It is best used to replace configuration values in a release pipeline. | |
.PARAMETER InputFile | |
The file containing the tokens. |