Define DynamicKeyword 'ExecTest'
Note: Don't copy&paste from following code. PowerShell SyntaxHighlighter remove some lines. Instead, use RAW view.
#Requires -Version 4.0
Set-StrictMode -Version Latest
function Install-VisualStudio | |
{ | |
[CmdletBinding()] | |
param ( | |
[string] $ImagePath, | |
[string[]] $ArgumentList, | |
[string] $InstallPath, | |
[string] $ProductKey | |
) | |
Write-Verbose "Install Visual Studio 2012..." |
#global variable | |
$global:ctx = @{ | |
VmName = "Windows 8.1" | |
Operation = "" | |
Session = $null | |
ComputerName = "TestPC" | |
DomainJoin =@{ | |
Name = "TEST.local" | |
Credential = Get-SavedCredential -Id DomainAdmin |
#Install SysInternals BGInfo/AutoLogon tools | |
function Install-SysInternalsTool | |
{ | |
#Target directory is %WinDir%C:\Windows\System32\SysInternals | |
$targetDir = Join-Path $env:WinDir "System32\SysInternals" | |
#Tools to be downloaded | |
$tools = @{ | |
Bginfo = "http://live.sysinternals.com/Bginfo.exe" | |
Autologon = "http://live.sysinternals.com/Autologon.exe" |
$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 |
#Based on <http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542> | |
function Test-RebootRequired | |
{ | |
$result = @{ | |
CBSRebootPending =$false | |
WindowsUpdateRebootRequired = $false | |
FileRenamePending = $false | |
SCCMRebootPending = $false | |
} |
function Add-WindowsDefenderExclusionsPolicy | |
{ | |
$ErrorActionPreference="Stop" | |
Set-StrictMode -Version Latest | |
#Get Hyper-V Settings | |
$vmHost = Get-VMHost | |
#Default Exclusion Entries | |
$excludes = @{ |
$ErrorActionPreference = "Stop" | |
function Main | |
{ | |
if ($Host.Name -ne "Windows PowerShell ISE Host"){ | |
return | |
} | |
$menus = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus | |
#TODO:support for non serializable object(example:PSCustomObject) | |
function Out-HtmlView | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter()] | |
[int]$Depth = 2, | |
[Parameter(Mandatory,ValueFromPipeLine)] | |
$InputObject | |
) |
<# | |
.SYNOPSIS | |
Configure Internet Explorer SecurityZone Settings. | |
.DESCRIPTION | |
Note: Configration is not applied immediately, Need to restart related services to apply zone settings. | |
.LINK | |
http://support.microsoft.com/kb/184456/en-us |