This file contains hidden or 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
class SplatClass : System.Collections.IEnumerable { | |
SplatClass() {} | |
[System.Collections.IEnumerator] GetEnumerator() { | |
# This can be any hashtable stored or derived from the class. This is | |
# just an example | |
$params = @{ | |
Path = '/tmp' | |
} | |
This file contains hidden or 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
Add-Type -Namespace LmAccess -Name Native -MemberDefinition @' | |
[DllImport("Netapi32.dll", CharSet = CharSet.Unicode, EntryPoint = "NetAddServiceAccount")] | |
private static extern int NativeNetAddServiceAccount( | |
IntPtr ServerName, | |
string AccountName, | |
IntPtr Password, | |
AddServiceFlags Flags); | |
/// <summary>Add a sMSA or gMSA to the current host.</summary> | |
/// <param name="accountName">The name of the MSA to install.</param> |

This file contains hidden or 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
. $PSScriptRoot\Start-ProcessEx.ps1 | |
Add-Type -Namespace Runas -Name NativeMethods -UsingNamespace @( | |
'Microsoft.Win32.SafeHandles', | |
'System.ComponentModel', | |
'System.Security.Principal' | |
) -MemberDefinition @' | |
[DllImport("Advapi32.dll", EntryPoint = "DuplicateTokenEx", SetLastError = true)] | |
private static extern bool NativeDuplicateTokenEx( | |
SafeHandle hExistingToken, |
This file contains hidden or 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
<# Check installation compliance #> | |
$Installed = Get-WmiObject -Class Win32Reg_AddRemovePrograms | Where-Object { $_.DisplayName -eq "Sentinel Agent" } | |
If ( -Not $Installed ) { | |
# Sentinel Agent not installed/missing. | |
Return $false | |
} Else { | |
Return $true | |
} |
This file contains hidden or 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
# Copyright: (c) 2021, Jordan Borean (@jborean93) <[email protected]> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
class EncodingTransformAttribute : Management.Automation.ArgumentTransformationAttribute { | |
[object] Transform([Management.Automation.EngineIntrinsics]$engineIntrinsics, [object]$InputData) { | |
$outputData = switch ($InputData) { | |
{ $_ -is [Text.Encoding] } { $_ } | |
{ $_ -is [string] } { | |
switch ($_) { |
This file contains hidden or 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 | |
} | |
#Import-Module PSColors | |
#Import-Module posh-git | |
Import-Module -Name Terminal-Icons |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8" ?> | |
<!-- Based on the format.ps1xml file from DirColors | |
https://github.com/DHowett/DirColors --> | |
<Configuration> | |
<SelectionSets> | |
<SelectionSet> | |
<Name>FileSystemTypes</Name> | |
<Types> | |
<TypeName>System.IO.DirectoryInfo</TypeName> |
This file contains hidden or 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
<# | |
Prerequisites: PowerShell v3+ | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
DOWNLOAD and DEFINITION OF THE FUNCTION: | |
irm https://gist.github.com/mklement0/ef57aea441ea8bd43387a7d7edfc6c19/raw/Invoke-WithEncoding.ps1 | iex |
This file contains hidden or 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
$Installed = Get-WmiObject -Class Win32Reg_AddRemovePrograms | Where-Object { $_.DisplayName -eq "Sentinel Agent" } | |
If ( -Not $Installed ) { | |
# Sentinel Agent not installed/missing. | |
Return $false | |
} Else { | |
$Version = $Installed.Version | |
$SentinelCtl = "C:\Program Files\SentinelOne\Sentinel Agent $Version\SentinelCtl.exe" | |
$Status = & $SentinelCtl "status" |