Skip to content

Commit 497b93d

Browse files
authored
Merge pull request #2 from RSE-Telecom-ICT/dev
Add Partner option for CSV generation
2 parents 7b745fc + cc680b2 commit 497b93d

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

hash-upload-partner.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#Download AzCopy
2+
Invoke-WebRequest -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile AzCopy.zip -UseBasicParsing
3+
4+
#Expand Archive
5+
Expand-archive -Path '.\AzCopy.zip' -Destinationpath '.\' -Force
6+
7+
#Find AzCopy
8+
$AzCopy = (Get-ChildItem -path '.\' -Recurse -File -Filter 'azcopy.exe').FullName
9+
10+
#Check if NuGet provider is installed, if not install it
11+
Write-Host "Checking if NuGet provider exists"
12+
if ((Get-PackageProvider -ListAvailable | where-object Name -eq NuGet) -ne $null) {
13+
Write-Host "NuGet provider exists"
14+
}
15+
else {
16+
Write-Host "NuGet provider is not installed, Installing now...."
17+
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
18+
Write-Host "NuGet provider Installed"
19+
}
20+
21+
#Check if Powershell Autopilot script is installed, if not install it
22+
Write-Host "Checking if script Get-WindowsAutopilotInfo exists"
23+
if (Get-InstalledScript -Name Get-WindowsAutopilotInfo) {
24+
Write-Host "script Get-WindowsAutopilotInfo exists"
25+
}
26+
else {
27+
Write-Host "Script Get-WindowsAutopilotInfo is not installed, Installing now...."
28+
Install-Script Get-WindowsAutopilotInfo -Force
29+
Write-Host "Script Get-WindowsAutopilotInfo Installed"
30+
}
31+
32+
#Use computername as part of the filename
33+
$Filename = "AutopilotHWID-" + $env:COMPUTERNAME.ToString() + ".csv"
34+
35+
#Get location of Autopilot script
36+
$scriptlocation = (Get-InstalledScript -Name Get-WindowsAutopilotInfo).InstalledLocation
37+
38+
#Generate CSV file for upload to azure blob storage
39+
& $scriptlocation\Get-WindowsAutoPilotInfo.ps1 -OutputFile $Filename -Partner -Force
40+
41+
#Set relative path to be used by AzCopy
42+
$RelativePath = './' + $Filename
43+
44+
#Use AzCopy to upload the generated CSV to blob storage
45+
& $AzCopy cp $RelativePath $env:SasURL --overwrite true

0 commit comments

Comments
 (0)