Skip to content

Commit

Permalink
Added Reset-ESSharedSecret
Browse files Browse the repository at this point in the history
  • Loading branch information
netikus authored Jun 21, 2022
1 parent 2792005 commit a212117
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 10 deletions.
99 changes: 89 additions & 10 deletions EventSentry-help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@
<command:verb>Add</command:verb>
<command:noun>ESVariable</command:noun>
<maml:description>
<maml:para>{{ Defines a new variable }}</maml:para>
<maml:para>{{ Adds a new variable to EventSentry }}</maml:para>
</maml:description>
</command:details>
<maml:description>
<maml:para>{{ Defines a new variable }}</maml:para>
<maml:para>{{ Adds a new variable to EventSentry }}</maml:para>
</maml:description>
<command:syntax>
<command:syntaxItem>
Expand Down Expand Up @@ -624,19 +624,19 @@
<command:verb>Remove</command:verb>
<command:noun>ESHost</command:noun>
<maml:description>
<maml:para>{{ Removes a host from a group }}</maml:para>
<maml:para>{{ Removes a host }}</maml:para>
</maml:description>
</command:details>
<maml:description>
<maml:para>{{ Removes a host from a group }}</maml:para>
<maml:para>{{ Removes a host }}</maml:para>
</maml:description>
<command:syntax>
<command:syntaxItem>
<maml:name>Remove-ESHost</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none">
<maml:name>Group</maml:name>
<maml:description>
<maml:para>{{ Name of the group from which the host should be removed from }}</maml:para>
<maml:para>{{ Name of the group the host is a member of }}</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand All @@ -648,7 +648,7 @@
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
<maml:name>Hostname</maml:name>
<maml:description>
<maml:para>{{ Host to remove }}</maml:para>
<maml:para>{{ Name of the host to remove }}</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand All @@ -663,7 +663,7 @@
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none">
<maml:name>Group</maml:name>
<maml:description>
<maml:para>{{ Name of the group from which the host should be removed from }}</maml:para>
<maml:para>{{ Name of the group the host is a member of }}</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand All @@ -675,7 +675,7 @@
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
<maml:name>Hostname</maml:name>
<maml:description>
<maml:para>{{ Host to remove }}</maml:para>
<maml:para>{{ Name of the host to remove }}</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -721,6 +721,85 @@
</command:examples>
<command:relatedLinks />
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details>
<command:name>Reset-ESSharedSecret</command:name>
<command:verb>Reset</command:verb>
<command:noun>ESSharedSecret</command:noun>
<maml:description>
<maml:para>{{ Resets the shared secret of one or more hosts with the collector }}</maml:para>
</maml:description>
</command:details>
<maml:description>
<maml:para>{{ Resets the shared secret of one or more hosts with the collector, for example when reinstalling the OS or the remote agent }}</maml:para>
</maml:description>
<command:syntax>
<command:syntaxItem>
<maml:name>Reset-ESSharedSecret</maml:name>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none">
<maml:name>Hostname</maml:name>
<maml:description>
<maml:para>{{ Hostname to reset the shared secret for. Multiple hostnames can be separated with a colon }}</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:syntaxItem>
</command:syntax>
<command:parameters>
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none">
<maml:name>Hostname</maml:name>
<maml:description>
<maml:para>{{ Hostname to reset the shared secret for. Multiple hostnames can be separated with a colon }}</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
<maml:name>String</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
</command:parameters>
<command:inputTypes>
<command:inputType>
<dev:type>
<maml:name>None</maml:name>
</dev:type>
<maml:description>
<maml:para></maml:para>
</maml:description>
</command:inputType>
</command:inputTypes>
<command:returnValues>
<command:returnValue>
<dev:type>
<maml:name>System.Object</maml:name>
</dev:type>
<maml:description>
<maml:para></maml:para>
</maml:description>
</command:returnValue>
</command:returnValues>
<maml:alertSet>
<maml:alert>
<maml:para></maml:para>
</maml:alert>
</maml:alertSet>
<command:examples>
<command:example>
<maml:title>-------------------------- Example 1 --------------------------</maml:title>
<dev:code>PS C:\&gt; {{ Reset-ESSharedSecret SRV-LOC1-0017 }}</dev:code>
<dev:remarks>
<maml:para>{{ Resets the shared secret of SRV-LOC1-0017 }}</maml:para>
</dev:remarks>
</command:example>
</command:examples>
<command:relatedLinks />
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<command:details>
<command:name>Set-ESAuthPasswordWindows</command:name>
Expand Down Expand Up @@ -866,7 +945,7 @@
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
<maml:name>PropertyValue</maml:name>
<maml:description>
<maml:para>{{ The value of the property to be set, for boolean values use "yes", "no", "true" or "false" }}</maml:para>
<maml:para>{{ The value of the property to be set }}</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -905,7 +984,7 @@
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none">
<maml:name>PropertyValue</maml:name>
<maml:description>
<maml:para>{{ The value of the property to be set, for boolean values use "yes", "no", "true" or "false" }}</maml:para>
<maml:para>{{ The value of the property to be set }}</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
<dev:type>
Expand Down
Binary file modified EventSentry.psd1
Binary file not shown.
17 changes: 17 additions & 0 deletions EventSentry.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,23 @@ function Set-ESVariable
}
}

function Reset-ESSharedSecret
{
Param(
[Parameter(Mandatory=$true)]
[string]$Hostname
)

if (ManagementConsoleIsRunning)
{ throw "EventSentry Management Console is running, only read-only actions can be performed." }

$regPathCollector = $ESRegPath + "\collector"

Set-ItemProperty -Path $regPathCollector -Name "reset_shared_secrets_hosts" -Value $Hostname -Force | Out-Null

saveConfig
}

function Remove-ESHost
{
Param(
Expand Down
60 changes: 60 additions & 0 deletions Reset-ESSharedSecret.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
external help file: EventSentry-help.xml
Module Name: EventSentry
online version:
schema: 2.0.0
---

# Reset-ESSharedSecret

## SYNOPSIS
{{ Resets the shared secret of one or more hosts with the collector }}

## SYNTAX

```
Reset-ESSharedSecret [-Hostname] <String> [<CommonParameters>]
```

## DESCRIPTION
{{ Resets the shared secret of one or more hosts with the collector, for example when reinstalling the OS or the remote agent }}

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Reset-ESSharedSecret SRV-LOC1-0017 }}
```

{{ Resets the shared secret of SRV-LOC1-0017 }}

## PARAMETERS

### -Hostname
{{ Hostname to reset the shared secret for. Multiple hostnames can be separated with a colon }}

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

0 comments on commit a212117

Please sign in to comment.