-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from aaalzand/master
Multiple fixes and enhancements
- Loading branch information
Showing
17 changed files
with
804 additions
and
672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1.97 KB
(100%)
Systems Manager/SSMAgent-Toolkit-Windows/SSMAgent-Toolkit.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Systems Manager/SSMAgent-Toolkit-Windows/SSMAgent-Toolkit/Public/Get-ServiceStartupMode.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<# | ||
.Synopsis | ||
Check the Startup mode for the service. | ||
.Description | ||
This is a public function used to check the startup mode for the services and compare it with the desire state. | ||
.Example | ||
Get-ServiceStartupMode | ||
.INPUTS | ||
ServiceName | ||
Skip = Switch to skip this function if the service is not available. | ||
.OUTPUTS | ||
New-PSObjectResponse -Check "$check" -Status "$value" -Note "$note" | ||
#> | ||
Function Get-ServiceStartupMode { | ||
[CmdletBinding()] | ||
param ( | ||
[String]$ServiceName = "amazonssmagent", | ||
[Switch]$Skip | ||
) | ||
$check = "Amazon SSM service startup mode" | ||
Write-Log -Message "New check....." | ||
Write-Log -Message "$check" | ||
|
||
$ServiceStartupMode = (Get-WmiObject Win32_Service -Filter "Name='$ServiceName'").StartMode | ||
|
||
if (-not ($Skip)) { | ||
if ($ServiceStartupMode -ne "Auto") { | ||
$value = $ServiceStartupMode | ||
$note = "It's recommended to use Automatic startup mode" | ||
Write-Log -Message "$ServiceName startup mode is not Automatic. It's recommended to update the startup more to Automatic. " -LogLevel "ERROR" | ||
} | ||
else { | ||
$value = $ServiceStartupMode | ||
$note = "This is the recommended startup mode to use" | ||
Write-Log -Message "$ServiceName startup mode is Automatic. This is the desired account." | ||
} | ||
} | ||
else { | ||
$value = "Skip" | ||
$note = "This test skipped since the $ServiceName service is not available" | ||
Write-Log -Message "The Amazon SSM service startup mode check skipped since The $ServiceName service is not available. " -LogLevel "ERROR" | ||
} | ||
|
||
return New-PSObjectResponse -Check "$check" -Status "$value" -Note "$note" | ||
} |
Oops, something went wrong.