Skip to content

Commit

Permalink
Search-TssMetadataHistory - new command
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Aug 18, 2021
1 parent 503ee21 commit 8994a53
Show file tree
Hide file tree
Showing 6 changed files with 391 additions and 4 deletions.
157 changes: 157 additions & 0 deletions docs/commands/metadata/Search-TssMetadataHistory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Search-TssMetadataHistory

## SYNOPSIS
Search metadata history

## SYNTAX

### item
```
Search-TssMetadataHistory [-TssSession] <Session> -ItemId <Int32> -ItemType <MetadataType> [-EndDate <String>]
[-StartDate <String>] [-SortBy <String>] [<CommonParameters>]
```

### field
```
Search-TssMetadataHistory [-TssSession] <Session> [-FieldId <Int32>] [-EndDate <String>] [-StartDate <String>]
[-SortBy <String>] [<CommonParameters>]
```

## DESCRIPTION
Search metadata history

## EXAMPLES

### EXAMPLE 1
```
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred
Search-TssMetadataHistory -TssSession $session -ItemId 5 -ItemType User
```

Returns history of all metadata fields for User ID5

## PARAMETERS

### -TssSession
TssSession object created by New-TssSession for authentication

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

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
### -ItemId
Item ID to return metadata
```yaml
Type: Int32
Parameter Sets: item
Aliases:

Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -ItemType
Item Type (Secret, User, Folder, Group)
```yaml
Type: MetadataType
Parameter Sets: item
Aliases: MetadataType
Accepted values: Secret, User, Folder, Group

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -FieldId
Metadata Field ID
```yaml
Type: Int32
Parameter Sets: field
Aliases:

Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -EndDate
Return history only entered before this time
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -StartDate
Return history only entered after this time
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -SortBy
Sort by specific property, default ItemId
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: ItemId
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
## OUTPUTS
### Thycotic.PowerShell.Metadata.History
## NOTES
Requires TssSession object returned by New-TssSession
## RELATED LINKS
[https://thycotic-ps.github.io/thycotic.secretserver/commands/metadata/Search-TssMetadataHistory](https://thycotic-ps.github.io/thycotic.secretserver/commands/metadata/Search-TssMetadataHistory)
[https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/metadata/Search-TssMetadataHistory.ps1](https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/metadata/Search-TssMetadataHistory.ps1)
66 changes: 66 additions & 0 deletions src/Thycotic.SecretServer.Format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -2809,5 +2809,71 @@
</TableControl>
</View>

<!-- Thycotic.PowerShell.Metadata.History -->
<View>
<Name>Metadata.History</Name>
<ViewSelectedBy>
<TypeName>Thycotic.PowerShell.Metadata.History</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
<TableColumnHeader />
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>ItemId</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>MetadataType</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>MetadataFieldSectionName</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>MetadataFieldName</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>MetadataFieldDataType</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueBit</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueDateTime</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueInt</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueNumber</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ValueString</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>CreateDateTime</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>CreateUserName</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>

</ViewDefinitions>
</Configuration>
8 changes: 4 additions & 4 deletions src/Thycotic.SecretServer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Shawn Melton
#
# Generated on: 8/17/2021
# Generated on: 8/18/2021
#

@{
Expand Down Expand Up @@ -71,7 +71,7 @@ NestedModules = @('bin\Thycotic.SecretServer.dll')
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Add-TssEventPipeline', 'Add-TssFolderPermission',
'Add-TssGroupMember', 'Add-TssSecretPermission',
'Add-TssSecretTemplateField', 'Close-TssSecret',
'Add-TssSecretTemplateField', 'Close-TssSecret', 'Close-TssSession',
'Disable-TssEventPipeline', 'Disable-TssEventPipelinePolicy',
'Disable-TssSecretCheckout', 'Disable-TssSecretEmail',
'Disable-TssUnlimitedAdmin', 'Disable-TssUser',
Expand Down Expand Up @@ -118,8 +118,8 @@ FunctionsToExport = 'Add-TssEventPipeline', 'Add-TssFolderPermission',
'Search-TssDistributedEngineSite', 'Search-TssEventPipeline',
'Search-TssEventPipelinePolicy', 'Search-TssFolder',
'Search-TssFolderPermission', 'Search-TssGroup', 'Search-TssMetadata',
'Search-TssMetadataSection', 'Search-TssReport',
'Search-TssReportSchedule', 'Search-TssRole',
'Search-TssMetadataHistory', 'Search-TssMetadataSection',
'Search-TssReport', 'Search-TssReportSchedule', 'Search-TssRole',
'Search-TssRpcPasswordType', 'Search-TssScript', 'Search-TssSecret',
'Search-TssSecretAccessRequest', 'Search-TssSecretDependency',
'Search-TssSecretHook', 'Search-TssSecretPermission',
Expand Down
33 changes: 33 additions & 0 deletions src/Thycotic.SecretServer/classes/metadata/History.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Thycotic.PowerShell.Enums;

namespace Thycotic.PowerShell.Metadata
{
public class History
{
public DateTime? CreateDateTime { get; set; }
public int CreateUserId { get; set; }
public string CreateUserName { get; set; }
public int ItemId { get; set; }
public MetadataFieldDataType MetadataFieldDataType { get; set; }
public int MetadataFieldId { get; set; }
public string MetadataFieldName { get; set; }
public int MetadataFieldSectionId { get; set; }
public string MetadataFieldSectionName { get; set; }
public string MetadataFieldTypeName { get; set; }
public int MetadataItemDataHistoryId { get; set; }
public int MetadataItemDataId { get; set; }
public MetadataType MetadataType { get; set; }
public string MetadataTypeName { get; set; }
public int SortOrder { get; set; }
public bool ValueBit { get; set; }
public DateTime? ValueDateTime { get; set; }
public int ValueInt { get; set; }
public double ValueNumber { get; set; }
public string ValueString { get; set; }
public string ValueUserDisplayName { get; set; }
}
}
Loading

0 comments on commit 8994a53

Please sign in to comment.