Skip to content

Instantly share code, notes, and snippets.

'Twas the night before Christmas, when all through the racks
Not a server was alerting, not even Compaqs.
The backups were written to tapes with care
In hopes that later the data would be there.
The machines were nestled all snug in their sleds
Whilst visions of vengeance danced in their heads;
And oncall in his three-wolf and I in my rack.
Had just settled down for some syn and some ack.
#requires -version 2.0
Add-Type @"
public class Shift {
public static int Right(int x, int count) { return x >> count; }
public static uint Right(uint x, int count) { return x >> count; }
public static long Right(long x, int count) { return x >> count; }
public static ulong Right(ulong x, int count) { return x >> count; }
public static int Left(int x, int count) { return x << count; }
public static uint Left(uint x, int count) { return x << count; }
public static long Left(long x, int count) { return x << count; }
function Get-InstalledSoftware
{
<#
.Summary
Get installed Software (browse the uninstall registry values...)
.Link
http://jeffwouters.nl/index.php/2014/01/a-powershell-function-to-get-the-installed-software/
.Notes
2014-01-30
Adjusted to provide searching of both x64 and x32 store for x64 boxes...
@jschell
jschell / connect-azurePSSession.ps1
Last active August 29, 2015 14:03
Functions to make WinRM on azure run smoother
function connect-azurePSSession
{
<#
borrowed from : http://jrich523.wordpress.com/2010/07/21/update-creating-a-profile-for-a-remote-session/
#>
[cmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
#Requires -Module ActiveDirectory
<#
.SYNOPSIS
This script retrieves the ACL from an Active Directory-integrated DNS record
.NOTES
Created on: 8/5/2014
Created by: Adam Bertram
Filename: Get-AdDnsRecordAcl.ps1
.EXAMPLE
@jschell
jschell / get-dateTime.ps1
Created September 23, 2015 23:55
ISO8601 dateTime
function get-dateTime
{
<#
.Synopsis
Returns ISO8601 date time format representation of current time.
.Description
At minimum, returns string with date as YYYY, mm, dd and time as HH, MM (24 hour time). Parameters allow for seconds and timezone of current locale to be returned.
.Parameter Format
# Event data after netlogon semaphoreAcquires >=1 added...
Event filter with query "SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance Isa "Win32_PerfFormattedData_Counters_Netlogon" AND TargetInstance.Name="_Total" AND TargetInstance.SemphoreAcquires >=1" could not be reactivated in namespace "//./root/CIMV2" because of error 0x80041002. Events cannot be delivered through this filter until the problem is corrected.
function Remove-ConstrainedLanguageMode {
<#
.Synopsis
Set language mode for a powershell session to 'full'.
.Description
Set language mode for a powershell session to 'full'. Leverages 'InstallUtil'
and the Microsoft.Diagnostics.Runtime.dll resouces to adjust in memory values.
.Example
function Get-VTFileReport
{
<#
.Synopsis
Get report from VT for given hash
.Description
Get report from VT for given hash
.Example
> Get-VTFileReport -ResourceHash ca67998f344b7a697cbf815e740a6272 -VTApiKey $myKey
function Get-FileHashFull
{
<#
.Synopsis
Recursive hash of files in a given path.
.Description
Recursive hash of files in given path, if specified with '-recurse'.
.Example
Get-FileHashFull -PathToHash c:\users\public\desktop -Recurse