Skip to content

Instantly share code, notes, and snippets.

function Test-PSCloudScriptAzKeyVaultSecret
{
[CmdletBinding()]
param()
Write-Host 'This is a PowerShell function in Azure Key Vault'
Write-Verbose 'This is a PowerShell function in Azure Key Vault with the Verbose parameter'
}
if (Get-Command Test-PSCloudScriptAzKeyVaultSecret)
{
@OSDeploy
OSDeploy / live.osdcloud.com.ps1
Last active January 18, 2022 06:48
PSCloudScript: iex (irm live.osdcloud.com)
'PSCloudScript for WinPE PSGallery and OSDCloud'
'iex (irm live.osdcloud.com)'
'https://gist.github.com/OSDeploy/30dc8839e8972493be1a343d509f423f'
'https://gist.githubusercontent.com/OSDeploy/30dc8839e8972493be1a343d509f423f/raw/live.osdcloud.com.ps1'
function Set-WinPELocalAppData
{
[CmdletBinding()]
param()
if (Get-Item env:LOCALAPPDATA -ErrorAction Ignore)
{
Write-Host "Hello" -Foregroundcolor Cyan
Write-Host "This is a PowerShell Script in a GitHub Gist at" -Foregroundcolor Cyan
Write-Host "https://gist.githubusercontent.com/OSDeploy/c3387cb58fc6490e1b5b0469dc668867/raw/946f1579047ac9e54299950220299dee8dd90d9c/WinPETest.ps1" -Foregroundcolor Cyan
Write-Host ""
Install-Module OSDSUS -Force -Verbose
Function Set-ScreenResolution {
param (
[Parameter(Mandatory=$true,
Position = 0)]
[int]
$Width,
[Parameter(Mandatory=$true,
Position = 1)]
[int]
$Height
$Wim = 'T:\install.wim'
$Mount = 'T:\Mount'
Mount-WindowsImage -ImagePath $Wim -Index 1 -Path $Mount | Out-Null
$Updates = Get-OSDSUS -Catalog OSDBuilder -UpdateArch x64 -UpdateBuild 1909 -UpdateOS "Windows 10" | Sort UpdateGroup -Descending
foreach ($Update in $Updates) {
Write-Verbose $Update.Title -Verbose
$UpdateFile = Save-OSDDownload -SourceUrl $Update.OriginUri -BitsTransfer -Verbose
Add-WindowsPackage -PackagePath $UpdateFile.FullName -Path $Mount -Verbose | Out-Null
}
Uninstall-Module -Name OSDBuilder -AllVersions -Force -ErrorAction SilentlyContinue
Remove-Module -Name OSDBuilder -Force -ErrorAction SilentlyContinue
Install-Module -Name OSDBuilder -Force
Import-Module -Name OSDBuilder -Force
Write-Warning "Close all open PowerShell sessions before using OSDBuilder"
$MDTRoot = 'D:\MDT'
Add-PSSnapIn Microsoft.BDD.PSSnapIn
New-PSDrive -Name “DS001” -PSProvider MDTProvider -Root $MDTRoot -EA SilentlyContinue
$PackageName = 'Office 2016 64-Bit'
$MDTPackage = "OSDUpdate Package $PackageName"
Import-MDTApplication -Path 'DS001:\Applications' -Enable 'True' `
-Name $MDTPackage -ShortName $MDTPackage `
-CommandLine "PowerShell.exe -ExecutionPolicy Bypass -File "".\Install-OSDUpdatePackage.ps1""" `
@OSDeploy
OSDeploy / Install-OSDUpdate.ps1
Created May 14, 2019 16:38
Install-OSDUpdate.ps1
<#
.NOTES
AUTHOR: David Segura
#>
#======================================================================================
# Validate Admin Rights
#======================================================================================
Write-Host ""
# Verify Running as Admin
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
@OSDeploy
OSDeploy / Update-OSDUpdateStandalone.ps1
Created May 14, 2019 16:36
Update-OSDUpdateStandalone.ps1
Clear-Host
if ($psise) {
$ScriptDirectory = Split-Path $psise.CurrentFile.FullPath
} else {
$ScriptDirectory = $PSScriptRoot
}
Write-Host "ScriptDirectory: $ScriptDirectory" -ForegroundColor Cyan
$OSDUpdateRepository = (Get-Item $ScriptDirectory).Parent.FullName
[cmi]
namespace=urn:schemas-microsoft-com:unattend
ClientServerSplit=true
AnswerFileFormat=1
professionalworkstationn=WYPNQ-8C467-V2W6J-TX4WX-WT2RQ
enterpriseneval=MNXKQ-WY2CT-JWBJ2-T68TQ-YBH2V
serverrdshCore=NJCF7-PW8QT-3324D-688JX-2YV66
serverstorageworkgroupeval=NXCTR-YXXWC-TK368-HGGTF-8YB99
onecoreupdateos=NFDPX-3MV8X-THC2X-QQ9QP-P9YY6