This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-NtSecurityDescriptor { | |
param | |
( | |
[string]$SecurityDescriptor | |
) | |
$ntsecdesc = New-Object Byte[] ($SecurityDescriptor.Length) | |
for ($i = 0; $i -lt $SecurityDescriptor.Length ; $i += 2) { | |
$ntsecdesc.Set(($i/2),([Byte]::Parse($SecurityDescriptor.Substring($i, 2), [System.Globalization.NumberStyles]::HexNumber))) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When a document is created in D:\Test with the extension .rtf This script will print its name | |
Register-CimIndicationEvent -Query "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE | |
TargetInstance ISA 'CIM_DataFile' AND (TargetInstance.Drive='D:' AND TargetInstance.Path='\\Test\\' AND TargetInstance.Extension='rtf')" -Action { | |
Write-Host $($Event.SourceEventArgs.NewEvent.TargetInstance.Name) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DscLocalConfigurationManager()] | |
Configuration PullClientV2 { | |
param( | |
[Parameter(Mandatory=$True)] | |
[String]$ConfigurationNames, | |
[Parameter(Mandatory=$True)] | |
[String]$Server | |
) | |
Settings | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Obj RefId="29"> | |
<TN RefId="9"> | |
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/ServerComponent_RemoteAccess</T> | |
<T>Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/ServerManager/MSFT_ServerManagerServerComponentDescriptor</T> | |
<T>Microsoft.Management.Infrastructure.CimInstance#ServerComponent_RemoteAccess</T> | |
<T>Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerManagerServerComponentDescriptor</T> | |
<T>Microsoft.Management.Infrastructure.CimInstance</T> | |
<T>System.Object</T> | |
</TN> | |
<ToString>ServerComponent_RemoteAccess</ToString> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$xmlpath = 'C:\Temp\DeploymentConfigTemplate.xml' | |
$features = New-Object -TypeName System.Collections.ArrayList | |
[xml]$xml = Get-Content $xmlpath | |
$xml.Objs.Obj.LST.Obj | ForEach-Object {$null = $features.Add($_.GetElementsByTagName('ToString').'#text')} | |
for ($i = 0; $i -lt $features.Count; $i++) | |
{ | |
$features[$i] = $features[$i].Substring($features[$i].IndexOf('_') + 1).Replace('_','-') | |
} | |
$features |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-AvailableComObjects { | |
$classesCom = '' | |
$classes = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey('SOFTWARE\\Classes').GetSubKeyNames() | |
[regex]::Matches($classes, '\w+\.\w+').Value | % {if ([Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\\Classes\\$_\\CLSID")) {$classesCom += "$_`r`n"}} | |
$classesCom.Replace("`r`n",' ').Split(' ') | Select-Object -Unique | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertto-cidr | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
[string]$netmask | |
) | |
$cidr = '' | |
foreach ($segment in $netmask.split('.')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Set-WakeEnabled | |
{ | |
<# | |
.SYNOPSIS | |
Set WoL on nic | |
Author: Jan-Henrik Damaschke (@jandamaschke) | |
License: BSD 3-Clause | |
Required Dependencies: None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SendMode Input | |
!z:: | |
loop 26 { | |
i := Asc("a") + A_Index - 1 | |
loop 26 { | |
j := Asc("a") + A_Index - 1 | |
loop 26 { | |
k := Asc("a") + A_Index - 1 | |
l := Chr(i) | |
m := Chr(j) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SetTimer,UPDATEDSCRIPT,1000 | |
UPDATEDSCRIPT: | |
FileGetAttrib,attribs,%A_ScriptFullPath% | |
IfInString,attribs,A | |
{ | |
FileSetAttrib,-A,%A_ScriptFullPath% | |
SplashTextOn,,,Script was updated, | |
Sleep,500 | |
Reload | |
} |