-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNew-SoftwareTag.ps1
More file actions
29 lines (29 loc) · 877 Bytes
/
New-SoftwareTag.ps1
File metadata and controls
29 lines (29 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function New-SoftwareTag {
Param (
[string]$Company = 'SDWorx'
,
[string]$Software = 'SQL CommVault FullAgent'
,
[string]$Version = '11.0.80 - 1'
,
[string]$Action = 'install'
,
[string]$Status
,
[string]$LogFile
)
$RegPath = "HKLM:\SOFTWARE\${Company}\${Software}\$Version"
try {
Get-ItemProperty -Path $RegPath -ErrorAction Stop
}
catch [System.Management.Automation.ItemNotFoundException] {
New-Item -Path $RegPath -Force
}
Set-ItemProperty -Path $RegPath -Name $Action -Value ( Get-Date -Format "dd/MM/yyyy HH:mm:ss" )
if ( [boolean]$Status ) {
Set-ItemProperty -Path $RegPath -Name 'Status' -Value $Status
}
if ( [boolean]$Status ) {
Set-ItemProperty -Path $RegPath -Name 'LogFile' -Value $LogFile
}
}