Skip to content

Instantly share code, notes, and snippets.

@BladeFireLight
BladeFireLight / Template-FirstRun.ps1
Last active August 29, 2015 14:22
Template FirstRun script for use with Start-ImageBuild.ps1
#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'
@BladeFireLight
BladeFireLight / SysPrep.ps1
Last active August 29, 2015 14:22
SysPrep script for use with Start-ImageBuild.ps1
#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'
} |
@BladeFireLight
BladeFireLight / Source-FirstRun.ps1
Last active December 26, 2020 14:50
Source FirstRun script for use with Start-ImageBuild.ps1
#requires -Version 3 -Modules ScheduledTasks, ServerManager
# Add any features required.
Start-Transcript -Path $PSScriptRoot\FirstRun.log
Get-WindowsFeature |
Where-Object -Property InstallState -EQ -Value Removed |
Install-WindowsFeature -Source D:\sources\sxs -Verbose
$features = Get-Content -Path $PSScriptRoot\Features.txt
Install-WindowsFeature $features -Verbose
$features = Get-Content -Path $PSScriptRoot\FeaturesIncludingSub.txt
@BladeFireLight
BladeFireLight / Source-FeaturesIncludingSub.txt
Created June 1, 2015 21:15
Feature with all Sub Features for Soruce.wim
DNS
DHCP
File-Services
RSAT
@BladeFireLight
BladeFireLight / Source-Features.txt
Created June 1, 2015 21:14
Feature list for Source.wim
AD-Domain-Services
AD-Certificate
ADCS-Cert-Authority
@BladeFireLight
BladeFireLight / Convert-WindowsIMage.ps1
Created June 1, 2015 21:13
Convert-WindowsImage Modified for use with Start-ImageBuild
<#
.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.
@BladeFireLight
BladeFireLight / Start-ImageBuild.ps1
Last active September 27, 2022 16:04
Automaticaly build Template vhdx and Source.wim
#requires -Version 3 -Modules Dism, Hyper-V, ScheduledTasks
#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]
Test-connection localhost