Skip to content

Commit

Permalink
Update bootstrap and add task.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
nrejepov authored and nrejepov committed Dec 13, 2024
1 parent 14bbc42 commit 7bc0d02
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
14 changes: 11 additions & 3 deletions azure-storage/bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
function Set-LabArtifacts {
$ProgressPreference = 'SilentlyContinue' # Ignore progress updates (100X speedup)
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls" # GitHub only supports tls 1.2 now (PS use 1.0 by default)
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/cloudacademy/azure-lab-provisioners/master/azure-storage/image.png" -OutFile C:\Users\student\Desktop\image.png
$ProgressPreference = 'SilentlyContinue'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# Download the image to Windows Temp folder
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/cloudacademy/azure-lab-provisioners/master/azure-storage/qaimage.png" -OutFile "C:\Windows\Temp\qaimage.png"

# Download the task XML. Using XML is preferred to minimize potential issues.
$taskXml = Invoke-WebRequest -Uri "https://raw.githubusercontent.com/cloudacademy/azure-lab-provisioners/master/azure-storage/task.xml" -UseBasicParsing | Select-Object -ExpandProperty Content

# Register the scheduled task using the XML definition
Register-ScheduledTask -TaskName "CopyImage" -Xml $taskXml -Force
}

function Disable-InternetExplorerESC {
Expand Down
22 changes: 22 additions & 0 deletions azure-storage/task.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<Triggers>
<LogonTrigger>
<Enabled>true</Enabled>
</LogonTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<GroupId>S-1-5-32-545</GroupId>
</Principal>
</Principals>
<Settings>
<Enabled>true</Enabled>
</Settings>
<Actions Context="Author">
<Exec>
<Command>powershell.exe</Command>
<Arguments>-NoProfile -WindowStyle Hidden -Command "Copy-Item 'C:\Windows\Temp\qaimage.png' ([environment]::GetFolderPath('Desktop')) -Force"</Arguments>
</Exec>
</Actions>
</Task>

0 comments on commit 7bc0d02

Please sign in to comment.