Skip to content

Instantly share code, notes, and snippets.

View AntGut's full-sized avatar

Anthony Gutierrez AntGut

View GitHub Profile
@AntGut
AntGut / Indent-String.ps1
Created October 3, 2018 05:49
Indents/PadLeft an InputString a specified amount (using specified char) and PadRight (with a specified char) if necessary to make output string the specified total length.
<#
.SYNOPSIS
Indents/PadLeft an InputString a specified amount (using specified char) and PadRight (with a specified char) if necessary to make output string the specified total length.
.DESCRIPTION
-- All PadLeft/PadRight constraints are adhered to.
-- By default if "IndentCount + InputString.Length() > TotalLength", Indent/PadLeft will take precedence [return string will be longer than TotalLength].
This behavior can be overridden using "UseTotalLength".
-- Default padding character is a <space> which can be overridden.
@AntGut
AntGut / Pad-String.ps1
Last active October 2, 2018 04:11
Pads an input string with spaces.
#--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==
function Pad-String ($InputString, $LeftPadding = 0, $RightPadding = 0) {
#--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==
<#
.SYNOPSIS
LeftPads input string by the specified amount and RightPads if necessary to make output string the specified total length.
.DESCRIPTION
All LeftPad/RightPad constraints are adhered to.
#>
@AntGut
AntGut / Get-ServiceLogOnAs.ps1
Last active September 27, 2018 06:52
Get information about the services on the local Microsoft Windows machine with focus on the "Log on as" account details.
<#
.SYNOPSIS
Get information about the services on the local Microsoft Windows machine with focus on the "Log on as" account details.
.PARAMETER Filtered
Services are filtered to those not using "built-in" accounts.
Basically ignore services where "Log on as" is "LocalSystem", "NTAuthority\NetorkService" and similar.
.PARAMETER Export
Service information is exported to CSV.