diff --git a/Public/Invoke-AtomicRunner.ps1 b/Public/Invoke-AtomicRunner.ps1 index bb8f8d7..3bac585 100755 --- a/Public/Invoke-AtomicRunner.ps1 +++ b/Public/Invoke-AtomicRunner.ps1 @@ -35,7 +35,7 @@ function Invoke-AtomicRunner { [Parameter(Mandatory = $false)] [switch] - $anyOS=$false, + $anyOS = $false, [parameter(Mandatory = $false)] [ValidateRange(0, [int]::MaxValue)] @@ -115,31 +115,22 @@ function Invoke-AtomicRunner { else { if ($debug) { LogRunnerMsg "Debug: pretending to rename the computer to $newHostName"; exit } if (-not $shouldRename) { Restart-Computer -Force } - if ($artConfig.gmsaAccount) { - $retry = $true; $count = 0 - while ($retry) { - # add retry loop to avoid this occassional error "The verification of the MSA failed with error 1355" - Invoke-Command -ComputerName '127.0.0.1' -ConfigurationName 'RenameRunnerEndpoint' -ScriptBlock { Rename-Computer -NewName $Using:newHostName -Force -Restart } - Start-Sleep 120; $count = $count + 1 - LogRunnerMsg "Retrying computer rename $count" - if ($count -gt 15) { $retry = $false } - } - } - else { - try { - Rename-Computer -NewName $newHostName -Force -Restart -ErrorAction stop - } - catch { - if ($artConfig.verbose) { LogRunnerMsg $_ } - } + $retry = $true; $count = 0 + while ($retry) { + Rename-Computer -NewName $newHostName -Force -Restart + Start-Sleep 120; $count = $count + 1 + LogRunnerMsg "Retrying computer rename $count" + if ($count -gt 60) { $retry = $false } } + Start-Sleep -seconds 30 LogRunnerMsg "uh oh, still haven't restarted - should never get to here" $retry = $true; $count = 0 while ($retry) { - Restart-Computer -Force - Start-Sleep 300; $count = $count + 1 + $count = $count + 1 LogRunnerMsg "Rename retry $count" + Restart-Computer -Force + Start-Sleep 300; if ($count -gt 60) { $retry = $false } } exit @@ -227,7 +218,7 @@ function Invoke-AtomicRunner { if ($scheduledTaskCleanup) { # Cleanup after running test Write-Host -Fore cyan "Sleeping for $SleepTillCleanup seconds before cleaning up for $($tr.Technique) $($tr.auto_generated_guid) "; Start-Sleep -Seconds $SleepTillCleanup - $htvars.Add("Cleanup",$true) + $htvars.Add("Cleanup", $true) Invoke-AtomicTestFromScheduleRow $tr } else { diff --git a/Public/config.ps1 b/Public/config.ps1 index 23171e8..662116d 100644 --- a/Public/config.ps1 +++ b/Public/config.ps1 @@ -21,9 +21,6 @@ $artConfig = [PSCustomObject]@{ kickOffDelay = New-TimeSpan -Minutes 0 # an additional delay before Invoke-KickoffAtomicRunner calls Invoke-AtomicRunner scheduleFileName = "AtomicRunnerSchedule.csv" - # [optional] If you need to use a group managed service account in order to rename the computer, enter it here - gmsaAccount = $null - # [optional] Logging Module, uses Syslog-ExecutionLogger if left blank and the syslogServer and syslogPort are set, otherwise it uses the Default-ExecutionLogger LoggingModule = ''