Public/Start-OSDCloudAzure.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
function Start-OSDCloudAzure { <# .SYNOPSIS Installs the OSDCloudAzure Module and starts OS Deployment from Azure Storage .DESCRIPTION Installs the OSDCloudAzure Module and starts OS Deployment from Azure Storage .EXAMPLE Start-OSDCloudAzure .EXAMPLE Start-OSDCloudAzure -Force .LINK https://github.com/OSDeploy/OSD/tree/master/Docs #> [CmdletBinding()] param ( [System.Management.Automation.SwitchParameter] #Resets everything to initial settings $Force ) if ($env:SystemDrive -eq 'X:') { if ($Force) { $Force = $false $Global:AzOSDCloudBlobImage = $null } $Transcript = "$((Get-Date).ToString('yyyy-MM-dd-HHmmss'))-OSDCloud.log" $null = Start-Transcript -Path (Join-Path "$env:SystemRoot\Temp" $Transcript) -ErrorAction Ignore Invoke-Expression -Command (Invoke-RestMethod -Uri functions.osdcloud.com) osdcloud-StartWinPE -OSDCloud -Azure Connect-OSDCloudAzure Get-OSDCloudAzureResources $null = Stop-Transcript -ErrorAction Ignore if ($Global:AzOSDCloudBlobImage) { Write-Host -ForegroundColor DarkGray '=========================================================================' Write-Host -ForegroundColor Green 'Start-OSDCloudAzure' & "$($MyInvocation.MyCommand.Module.ModuleBase)\Projects\OSDCloudAzure\MainWindow.ps1" Start-Sleep -Seconds 2 if ($Global:StartOSDCloud.AzOSDCloudImage) { Write-Host -ForegroundColor DarkGray '=========================================================================' Write-Host -ForegroundColor Green "Invoke-OSDCloud ... Starting in 5 seconds..." Start-Sleep -Seconds 5 Invoke-OSDCloud } else { Write-Warning "Unable to get a Windows Image from OSDCloudAzure to handoff to Invoke-OSDCloud" } } else { Write-Warning 'Unable to find resources to OSDCloudAzure' } } else { Write-Warning "OSDCloudAzure must be run from WinPE" } } |