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
function Test-EventSourceByLog { | |
<# | |
.SYNOPSIS | |
This tests for multiple sources in multiple eventlogs | |
.DESCRIPTION | |
This works regardless of if it exists directly in registry or not. | |
This is different than the Test-EventSource which uses a dotnet function | |
to check for all the sources that are directly listed in the registry. | |
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.Concurrent; | |
using System.Management.Automation; | |
using System.Threading; | |
using System.Threading.Tasks; | |
public abstract class AsyncPSCmdlet : PSCmdlet, IDisposable | |
{ | |
private enum PipelineType | |
{ |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFramework>net7.0</TargetFramework> | |
<ImplicitUsings>enable</ImplicitUsings> | |
<Nullable>enable</Nullable> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="System.Management.Automation" Version="7.3.2" PrivateAssets="all" /> |
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
<Configuration> | |
<ViewDefinitions> | |
<View> | |
<Name>Utility.PullRequest</Name> | |
<ViewSelectedBy> | |
<TypeName>Utility.PullRequest</TypeName> | |
</ViewSelectedBy> | |
<CustomControl> | |
<CustomEntries> | |
<CustomEntry> |
![2022-10-09_silly_dump-part1.png](https://gist.github.com/ninmonkey/47b0978298229a35e517fb200ad0d1ca/raw/f7d494e7ddae596916ea3a94d9474bcfab1ad55e/2022-10-09_silly_dump-part1.png)
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
# Copyright: (c) 2022, Jordan Borean (@jborean93) <jborean93@gmail.com> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
Function Get-WTSSessionInfo { | |
<# | |
.SYNOPSIS | |
Enumerates sessions on a Windows host. | |
.DESCRIPTION | |
Enumerates all the sessions available on a Windows host through the WTSEnumerateSessionsExW API. |
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 | |
using namespace System.Linq | |
using namespace System.Collections | |
using namespace System.Collections.Generic | |
using namespace System.Management.Automation | |
using namespace System.Management.Automation.Language | |
using namespace System.Reflection | |
# Hey person reading this! Don't do this, alright? You'll have a bad time. ty |
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
# Copyright: (c) 2021, Jordan Borean (@jborean93) <jborean93@gmail.com> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
using namespace System.Management.Automation | |
using namespace System.Management.Automation.Host | |
using namespace System.Runtime.InteropServices | |
$typeParams = @{ | |
TypeDefinition = @' | |
using Microsoft.Win32.SafeHandles; |
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
# Copyright: (c) 2021, Jordan Borean (@jborean93) <jborean93@gmail.com> | |
# 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 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) <jborean93@gmail.com> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
Function Get-ServiceCertStore { | |
<# | |
.SYNOPSIS | |
Open an X509 store to a service account. | |
.DESCRIPTION | |
Opens an X509 store to the NT SERVICE account specified. The X509 store can be used to then add/remove/enumerate |
NewerOlder