Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberbuff committed Apr 14, 2024
1 parent 2c6fb69 commit 2a6b59c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions Public/AtomicRunnerService.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ Param(

[Parameter(ParameterSetName='Setup', Mandatory=$true)]
[String]$UserName, # Set the service to run as this user

[Parameter(ParameterSetName='Setup', Mandatory=$false)]
[String]$Password, # Use this password for the user
[SecureString]$Password, # Use this password for the user

[Parameter(ParameterSetName='Setup', Mandatory=$false)]
[String]$installDir= "${ENV:windir}\System32", # Where to install the service files

[Parameter(ParameterSetName='Setup2', Mandatory=$false)]
[System.Management.Automation.PSCredential]$Credential, # Service account credential

Expand Down Expand Up @@ -331,7 +331,7 @@ Function Now {
$ms = $true
$nsSuffix = "000"
}
}
}
if ($ms) {
$now += ".{0:000}$nsSuffix" -f $Date.MilliSecond
}
Expand Down Expand Up @@ -399,7 +399,7 @@ Function Get-PSThread () {
[Parameter(Mandatory=$false, ValueFromPipeline=$true, Position=0)]
[int[]]$Id = $PSThreadList.Keys # List of thread IDs
)
$Id | % { $PSThreadList.$_ }
$Id | ForEach-Object { $PSThreadList.$_ }
}

Function Start-PSThread () {
Expand Down Expand Up @@ -441,7 +441,7 @@ Function Start-PSThread () {
$PSPipeline = [powershell]::Create()
$PSPipeline.Runspace = $RunSpace
$PSPipeline.AddScript($ScriptBlock) | Out-Null
$Arguments | % {
$Arguments | ForEach-Object {
Write-Debug "Adding argument [$($_.GetType())]'$_'"
$PSPipeline.AddArgument($_) | Out-Null
}
Expand Down Expand Up @@ -764,7 +764,7 @@ $source = @"
AutoLog = true;
eventLog = new System.Diagnostics.EventLog(); // EVENT LOG [
if (!System.Diagnostics.EventLog.SourceExists(ServiceName)) {
if (!System.Diagnostics.EventLog.SourceExists(ServiceName)) {
System.Diagnostics.EventLog.CreateEventSource(ServiceName, "$logName");
}
eventLog.Source = ServiceName;
Expand Down Expand Up @@ -807,7 +807,7 @@ $source = @"
Win32Exception w32ex = e as Win32Exception; // Try getting the WIN32 error code
if (w32ex == null) { // Not a Win32 exception, but maybe the inner one is...
w32ex = e.InnerException as Win32Exception;
}
}
if (w32ex != null) { // Report the actual WIN32 error
serviceStatus.dwWin32ExitCode = w32ex.NativeErrorCode;
} else { // Make up a reasonable reason
Expand Down Expand Up @@ -845,7 +845,7 @@ $source = @"
Win32Exception w32ex = e as Win32Exception; // Try getting the WIN32 error code
if (w32ex == null) { // Not a Win32 exception, but maybe the inner one is...
w32ex = e.InnerException as Win32Exception;
}
}
if (w32ex != null) { // Report the actual WIN32 error
serviceStatus.dwWin32ExitCode = w32ex.NativeErrorCode;
} else { // Make up a reasonable reason
Expand Down Expand Up @@ -977,7 +977,7 @@ if ($Setup) { # Install the service
Write-Debug "Installation is necessary" # Also avoids a ScriptAnalyzer warning
# And continue with the installation.
}
if (!(Test-Path $installDir)) {
if (!(Test-Path $installDir)) {
New-Item -ItemType directory -Path $installDir | Out-Null
}
# Copy the service script into the installation directory
Expand Down
2 changes: 1 addition & 1 deletion Public/Invoke-AtomicRunner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function Invoke-AtomicRunner {
# Perform cleanup, Showdetails or Prereq stuff for all scheduled items and then exit
if ($Cleanup -or $ShowDetails -or $CheckPrereqs -or $ShowDetailsBrief -or $GetPrereqs -or $listOfAtomics) {
$schedule | ForEach-Object {
Invoke-AtomicTestFromScheduleRow $_
Invoke-AtomicTestFromScheduleRow $_
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion Public/Invoke-KickoffAtomicRunner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Invoke-KickoffAtomicRunner {
if ($artConfig.debug) { $Arguments = "-Command Invoke-AtomicRunner *>> $all_log_file" } else { $Arguments = "-Command Invoke-AtomicRunner" }
# Invoke the atomic as its own process because we don't want to skip the cleanup and rename process in the event that AV kills the process running the atomic
$p1 = Start-Process -FilePath $FileName -ArgumentList $Arguments -WorkingDirectory $WorkingDirectory -PassThru

if ($artConfig.debug) { $Arguments = "-Command Invoke-AtomicRunner -scheduledTaskCleanup *>> $all_log_file_cleanup" } else { $Arguments = "-Command Invoke-AtomicRunner -scheduledTaskCleanup" }
$p2 = Start-Process -FilePath $FileName -ArgumentList $Arguments -WorkingDirectory $WorkingDirectory -PassThru

Expand Down
8 changes: 4 additions & 4 deletions Public/Invoke-SetupAtomicRunner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function Invoke-SetupAtomicRunner {
Param(
[Parameter(Mandatory = $false)]
[switch]
$SkipServiceSetup
$SkipServiceSetup
)

# ensure running with admin privs
Expand Down Expand Up @@ -50,7 +50,7 @@ function Invoke-SetupAtomicRunner {
$time2 = 600000 # 10 minutes in miliseconds
$actionLast = "restart"
$timeLast = 3600000 # 1 hour in miliseconds
$resetCounter = 86400 # 1 day in seconds
$resetCounter = 86400 # 1 day in seconds
$services = Get-CimInstance -ClassName 'Win32_Service' | Where-Object { $_.DisplayName -imatch $ServiceDisplayName }
$action = $action1 + "/" + $time1 + "/" + $action2 + "/" + $time2 + "/" + $actionLast + "/" + $timeLast
foreach ($service in $services) {
Expand Down Expand Up @@ -137,14 +137,14 @@ function Add-EnvPath {

$persistedPaths = [Environment]::GetEnvironmentVariable('Path', $containerType) -split ';'
if ($persistedPaths -notcontains $Path) {
$persistedPaths = $persistedPaths + $Path | where { $_ }
$persistedPaths = $persistedPaths + $Path | Where-Object { $_ }
[Environment]::SetEnvironmentVariable('Path', $persistedPaths -join ';', $containerType)
}
}

$envPaths = $env:Path -split ';'
if ($envPaths -notcontains $Path) {
$envPaths = $envPaths + $Path | where { $_ }
$envPaths = $envPaths + $Path | Where-Object { $_ }
$env:Path = $envPaths -join ';'
}
}

0 comments on commit 2a6b59c

Please sign in to comment.