-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhash-upload.ps1
More file actions
45 lines (36 loc) · 1.76 KB
/
hash-upload.ps1
File metadata and controls
45 lines (36 loc) · 1.76 KB
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
#Download AzCopy
Invoke-WebRequest -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile AzCopy.zip -UseBasicParsing
#Expand Archive
Expand-archive -Path '.\AzCopy.zip' -Destinationpath '.\' -Force
#Find AzCopy
$AzCopy = (Get-ChildItem -path '.\' -Recurse -File -Filter 'azcopy.exe').FullName
#Check if NuGet provider is installed, if not install it
Write-Host "Checking if NuGet provider exists"
if ((Get-PackageProvider -ListAvailable | where-object Name -eq NuGet) -ne $null) {
Write-Host "NuGet provider exists"
}
else {
Write-Host "NuGet provider is not installed, Installing now...."
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Write-Host "NuGet provider Installed"
}
#Check if Powershell Autopilot script is installed, if not install it
Write-Host "Checking if script Get-WindowsAutopilotInfo exists"
if (Get-InstalledScript -Name Get-WindowsAutopilotInfo -ErrorAction SilentlyContinue) {
Write-Host "script Get-WindowsAutopilotInfo exists"
}
else {
Write-Host "Script Get-WindowsAutopilotInfo is not installed, Installing now...."
Install-Script Get-WindowsAutopilotInfo -Force
Write-Host "Script Get-WindowsAutopilotInfo Installed"
}
#Use computername as part of the filename
$Filename = "AutopilotHWID-" + $env:COMPUTERNAME.ToString() + ".csv"
#Get location of Autopilot script
$scriptlocation = (Get-InstalledScript -Name Get-WindowsAutopilotInfo).InstalledLocation
#Generate CSV file for upload to azure blob storage
& $scriptlocation\Get-WindowsAutoPilotInfo.ps1 -OutputFile $Filename
#Set relative path to be used by AzCopy
$RelativePath = './' + $Filename
#Use AzCopy to upload the generated CSV to blob storage
& $AzCopy cp $RelativePath $env:SasURL --overwrite true