Skip to content

Commit

Permalink
Merge pull request #1 from LeanKit-Labs/update_get_installer
Browse files Browse the repository at this point in the history
Minor fix to Get Method in Installer Resource
  • Loading branch information
Chris Lee authored Oct 19, 2017
2 parents ffa8828 + c75177a commit dd0cf93
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ The **WazuhOSSec** DSC module contains the **WazuhAgentInstall** and **WazuhAgen
* **Ensure** - Register the agent with the wazuh server. (Present/Absent)

## Versions
### 1.0.0
* Some stuff here
* More stuff here
### 1.0.1
* Included check for Service AND Package in Get() of WazuhAgentInstall
* More Verbose output in a couple of helper methods

### 1.0.0
* Initial commit of DSC resource
6 changes: 3 additions & 3 deletions WazuhOSSec.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'WazuhOSSec.psm1'

# Version number of this module.
ModuleVersion = '1.0.0'
ModuleVersion = '1.0.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand All @@ -30,7 +30,7 @@
Copyright = '(c) 2017 LeanKit Inc. All rights reserved.'

# Description of the functionality provided by this module
# Description = ''
Description = 'Install and Register Wazuh Ossec Agent'

# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '5.0'
Expand Down Expand Up @@ -101,7 +101,7 @@
# LicenseUri = ''

# A URL to the main website for this project.
# ProjectUri = ''
ProjectUri = 'https://github.com/LeanKit-Labs/WazuhOSSec'

# A URL to an icon representing this module.
# IconUri = ''
Expand Down
7 changes: 5 additions & 2 deletions WazuhOSSec.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ class WazuhAgentInstall
# Get Method should return only the properties of the resource at the time it is run.
[WazuhAgentInstall] Get()
{
if (Get-Service -Name "*OSSec*")
$_WazuhPackage = Get-Package -Name "*Wazuh*" -ProviderName Programs -ErrorAction SilentlyContinue
if ((Get-Service -Name "*OSSec*") -and ($_WazuhPackage.Status -eq "Installed"))
{
Write-Verbose "Ossec Service Installed"
$this.Installed = 'Present'
$this.InstalledVersion = (Get-Package -Name "*Wazuh*" -ProviderName Programs).Version
$this.InstalledVersion = $_WazuhPackage.Version
Write-Verbose "Current installed version: $($this.InstalledVersion)"
}
else
Expand Down Expand Up @@ -114,6 +115,7 @@ class WazuhAgentInstall
}
else
{
Write-Verbose "New Version detected: $($InstallerInfo.VersionInfo.Fileversion)"
return $true
}
}
Expand All @@ -123,6 +125,7 @@ class WazuhAgentInstall
try
{
Start-Process -NoNewWindow -ErrorAction stop -Filepath $AgentExePath -ArgumentList '/S'
Write-Verbos "Agent installation complete."
}
catch
{
Expand Down

0 comments on commit dd0cf93

Please sign in to comment.