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
Test-connection localhost |
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 2 | |
Function Add-WindowsUpdate | |
{ | |
param ( | |
[string]$Criteria = "IsInstalled=0 and Type='Software'" , | |
[switch]$AutoRestart, | |
[Switch]$ShutdownAfterUpdate, | |
[switch]$ForceRestart, | |
[Switch]$ShutdownOnNoUpdate |
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 2 -Modules ScheduledTasks, ServerManager | |
# Add any features required. | |
Start-Transcript -Path $PSScriptRoot\FirstRun.log | |
$features = Get-Content -Path $PSScriptRoot\Features.txt | |
Install-WindowsFeature $features -IncludeAllSubFeature -Verbose | |
$features = Get-Content -Path $PSScriptRoot\FeaturesIncludingSub.txt | |
Install-WindowsFeature $features -Verbose | |
$Paramaters = @{ | |
Action = New-ScheduledTaskAction -Execute '%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-NoProfile -ExecutionPolicy Bypass -File C:\PSTemp\AtStartup.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
#requires -Version 1 -Modules ScheduledTasks, ServerManager | |
#region cleanup | |
Start-Transcript -Path c:\sysprep.log | |
Get-ScheduledTask -TaskName AtStartup | Unregister-ScheduledTask -Confirm:$false | |
Remove-Item -Path c:\unattend.xml | |
Get-ChildItem -Path c:\pstemp\ -Exclude AtStartup.ps1 | Remove-Item | |
Get-WindowsFeature | | |
Where-Object -FilterScript { | |
$_.Installed -eq 0 -and $_.InstallState -eq 'Available' | |
} | |
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
DNS | |
DHCP | |
File-Services | |
RSAT |
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
AD-Domain-Services | |
AD-Certificate | |
ADCS-Cert-Authority |
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
<# | |
.NOTES | |
Copyright (c) Microsoft Corporation. All rights reserved. | |
Use of this sample source code is subject to the terms of the Microsoft | |
license agreement under which you licensed this sample source code. If | |
you did not accept the terms of the license agreement, you are not | |
authorized to use this sample source code. For the terms of the license, | |
please see the license agreement between you and Microsoft or, if applicable, | |
see the LICENSE.RTF on your install media or the root of your tools installation. |
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 3 -Modules Dism, Hyper-V | |
#Wrapper arround Convert-WindowsImage script to it acts like a function. | |
function Convert-WindowsImage | |
{ | |
Param | |
( | |
[Parameter(ParameterSetName = 'SRC', Mandatory = $true, ValueFromPipeline = $true)] | |
[Alias('WIM')] | |
[string] | |
[ValidateNotNullOrEmpty()] |
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 test-function | |
{ | |
[CmdletBinding()] | |
Param() | |
$key = 'template' | |
$IsoPath = 'c:\iso\win2012r2.iso' | |
$UnattendPath = 'g:\temp\unattent.xml' | |
$Configdata = @{Template = @{ IsoEdition = 4} } | |
$CwiParamaters = @{ |
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
I have tested on Windows 10 and Hyper-V server 2012 R2 | |
When a drive is mounted from a function inside a moduel the drive is not avalible to the module. | |
but if the function is part of a script or dot sorced it works. | |
Run Fails.ps1 first. (Fails) | |
Run Always-works.ps1 (Works) | |
the run Fails.ps1 again (Works) |
OlderNewer