Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting -AssessOnly does not work & does not support subfolders for ArcRemoteShare in 1.0.8 #25

Open
Borgquite opened this issue Apr 12, 2024 · 0 comments · May be fixed by #26
Open

Setting -AssessOnly does not work & does not support subfolders for ArcRemoteShare in 1.0.8 #25

Borgquite opened this issue Apr 12, 2024 · 0 comments · May be fixed by #26

Comments

@Borgquite
Copy link
Contributor

Borgquite commented Apr 12, 2024

In version 1.0.8, the AssessOnly check doesn't work at all. The issues I can see are:

In ScheduledTask.xml, the ArcRemoteShare switch parameter in the Scheduled Task now has single quotations around it:

<ImmediateTaskV2 clsid="{9756B581-76EC-4169-9AFC-0CA8D43ADB5F}" name="Arc Agent Installation" image="0" changed="2021-12-15 18:30:36" uid="{1A3FC9E2-F3D5-442D-B6AD-5CDC09D2594F}" userContext="0" removePolicy="0"><Properties action="C" name="Arc Agent Installation" runAs="NT AUTHORITY\System" logonType="S4U"><Task version="1.3"><RegistrationInfo><Author>AD\admin</Author><Description></Description></RegistrationInfo><Principals><Principal id="Author"><UserId>NT AUTHORITY\System</UserId><LogonType>S4U</LogonType><RunLevel>HighestAvailable</RunLevel></Principal></Principals><Settings><IdleSettings><Duration>PT10M</Duration><WaitTimeout>PT1H</WaitTimeout><StopOnIdleEnd>true</StopOnIdleEnd><RestartOnIdle>false</RestartOnIdle></IdleSettings><MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy><DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries><StopIfGoingOnBatteries>true</StopIfGoingOnBatteries><AllowHardTerminate>true</AllowHardTerminate><StartWhenAvailable>true</StartWhenAvailable><AllowStartOnDemand>true</AllowStartOnDemand><Enabled>true</Enabled><Hidden>false</Hidden><ExecutionTimeLimit>P3D</ExecutionTimeLimit><Priority>7</Priority><DeleteExpiredTaskAfter>PT0S</DeleteExpiredTaskAfter></Settings><Triggers><TimeTrigger><StartBoundary>%LocalTimeXmlEx%</StartBoundary><EndBoundary>%LocalTimeXmlEx%</EndBoundary><Enabled>true</Enabled></TimeTrigger></Triggers><Actions Context="Author"><Exec><Command>PowerShell.exe</Command><Arguments>-ExecutionPolicy Bypass -Command "Copy-Item '\\{ReportServerFQDN}\{ArcRemoteShare}\AzureArcDeploy\EnableAzureArc.ps1' $ENV:TEMP -Force; &amp; $ENV:TEMP\EnableAzureArc.ps1 -ArcRemoteShare '{ArcRemoteShare}'"</Arguments></Exec><Exec><Command>PowerShell.exe</Command><Arguments>-ExecutionPolicy Bypass -Command "Remove-Item $ENV:TEMP\EnableAzureArc.ps1 -Force -ErrorAction SilentlyContinue"</Arguments></Exec></Actions></Task></Properties><Filters><FilterCollection bool="AND" not="0"><FilterOs bool="AND" not="0" class="NT" version="2K8R2" type="NE" edition="NE" sp="NE"/><FilterOs bool="OR" not="0" class="NT" version="WIN8S" type="NE" edition="NE" sp="NE"/><FilterOs bool="OR" not="0" class="NT" version="WINBLUESRV" type="NE" edition="NE" sp="NE"/><FilterOs bool="OR" not="0" class="NT" version="WINTHRESHOLDSRV" type="NE" edition="NE" sp="NE"/></FilterCollection></Filters></ImmediateTaskV2>

But the code that updates it in DeployGPO still assumes there are no single quotes (from a previous version?)

$xmlcontent -replace "ArcRemoteShare $ArcRemoteShare", "ArcRemoteShare $ArcRemoteShare -AssessOnly" | Out-File $ScheduledTaskfile -Encoding utf8 -Force -ErrorAction Stop

In addition, if the ArcRemoteShare has a backslash in it (e.g. ShareName\FolderName to store the logs in a subfolder) then the regular expression will break.

I'll submit a PR shortly with both of these fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant