This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 5.0.9814.0 | |
if(!($PSVersionTable.PSVersion.Major -ge 5 -and $PSVersionTable.PSVersion.Build -ge 9814)) { | |
"Sorry you need PSVersion 5.0.9814.0 or newer" | |
$psversiontable | |
return | |
} | |
Add-Type -AssemblyName presentationframework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-Log { | |
<# | |
.SYNOPSIS | |
Create a new log. | |
.DESCRIPTION | |
The New-Log function is used to create a new log file or Windows Event log. A log object is also created | |
and either saved in the global PSLOG variable (default) or sent to the pipeline. The latter is useful if | |
you need to write to different log files in the same script/function. | |
.EXAMPLE | |
New-Log '.\myScript.log' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -RunAsAdministrator | |
#Requires -Version 3.0 | |
#References: | |
#Getting Started with Nano Server <https://technet.microsoft.com/en-us/library/mt126167.aspx> | |
#Quick Guide - Deploying Nano Server using PowerShell <http://deploymentresearch.com/Research/Post/479/Quick-Guide-Deploying-Nano-Server-using-PowerShell> | |
param ( | |
#[ValidateScript({ Test-Path $_ })] | |
$ConvertWindowsImageScriptPath = 'D:\work\NanoServerSetup\Convert-WindowsImage.ps1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString() | |
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null | |
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01) | |
#Convert to .NET type for XML manipuration | |
$toastXml = [xml] $template.GetXml() | |
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -RunAsAdministrator | |
#Requires -Version 5.0 | |
$ErrorActionPreference = "Stop" | |
function Main | |
{ | |
#Size of dummy file, that transffered by PSRemoting. | |
$fileSize = 10MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
Import-Module EventTracingManagement #Require Windows 10 enviroment(it use underlying CIM APIs https://msdn.microsoft.com/en-us/library/dn919685%28v=vs.85%29.aspx) | |
Use-NuGetPackage Microsoft.Diagnostics.Tracing.TraceEvent -Verbose #Require PSNuGet<https://github.com/altrive/PSNuGet> | |
$sessionName = "MyRealTimeSession" | |
$providerName = "Sample.EtwTrace" | |
$providerGuid = [Microsoft.Diagnostics.Tracing.Session.TraceEventProviders]::GetEventSourceGuidFromName($providerName) | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Our XAML for the WPF-based GUI. | |
$inputXAML = @" | |
<Window x:Name="Pick_Console" x:Class="LetUsWPF.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:local="clr-namespace:LetUsWPF" | |
mc:Ignorable="d" | |
Title="MainWindow" Height="275" Width="410"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Show-Map { | |
<# | |
.Synopsis | |
Launches a map in the browser using an address from the command line or the clipboard | |
#> | |
param( | |
$address, | |
[Switch]$UseBing | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$eventLogCollector= 'MYSERVER' | |
#XML Filter for Get-WinEvent | |
$eventFilter = @" | |
<QueryList> | |
<Query Id="0" Path="ForwardedEvents"> | |
<Select Path="ForwardedEvents">*[System[(EventID=4624 or EventID=4800 or EventID=4801 or EventID=4634)]]</Select> | |
</Query> | |
</QueryList> | |
"@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ComputerWMIInfo { | |
<# | |
.Synopsis | |
Retrieves WMIObjects for a computer. | |
.DESCRIPTION | |
Retrieves WMIObjects for a computer and formats the information for readability. | |
.INPUTS | |
String | |
A string is recieved by the ComputerName and WMIObject parameter. | |
.OUTPUTS |
OlderNewer