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 New-PivotKlaxon | |
| { | |
| Add-Type -AssemblyName PresentationCore | |
| $song = [uri](Join-Path (Split-Path -parent $PSCommandPath) "klaxon.mp3") | |
| $MediaPlayer = New-Object System.Windows.Media.MediaPlayer | |
| $voice = new-object -com SAPI.SpVoice | |
| $MediaPlayer.Open($song) | |
| while( $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds -eq $null) | |
| { | |
| start-sleep -milliseconds 100 |
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
| Script MongoDBAdminConfiguration | |
| { | |
| SetScript = | |
| { | |
| import-module gac | |
| Add-Type -AssemblyName (Get-GACAssembly "MongoDB.Bson") | |
| Add-Type -AssemblyName (Get-GACAssembly "MongoDB.Driver") | |
| $client = new-object MongoDB.Driver.MongoClient("mongodb://localhost") | |
| $server = $client.GetServer() | |
| $adminDB = $server.GetDatabase("admin") |
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
| # Create a Windows Identity Principal (note the cast) | |
| $principal = [Security.Principal.WindowsPrincipal](new-object System.Security.Principal.WindowsIdentity("<username>@<domain>")) | |
| # Check if it is a member of a group | |
| $princial.IsInRole("<domain>\<group name>") | |
| # Other useful things you can do: | |
| $identity = (new-object System.Security.Principal.WindowsIdentity("<username>@<domain>")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add-Type -TypeDefinition @" | |
| using System; | |
| using System.Management.Automation; | |
| [AttributeUsageAttribute(AttributeTargets.Class)] | |
| public class NewCustomAttribute : CmdletCommonMetadataAttribute { | |
NewerOlder