-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRemove-WEMStorefrontSetting.ps1
53 lines (41 loc) · 1.68 KB
/
Remove-WEMStorefrontSetting.ps1
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<#
.Synopsis
Removes a Storefront Setting object from the WEM Database.
.Description
Removes a Storefront Setting object from the WEM Database.
.Link
https://msfreaks.wordpress.com
.Parameter IdStorefrontSetting
..
.Parameter Connection
..
.Example
.Notes
Author: Arjan Mensch
#>
function Remove-WEMStorefrontSetting {
[CmdletBinding()]
param (
[Parameter(Mandatory=$True, ValueFromPipelineByPropertyName=$True)]
[int]$IdStorefrontSetting,
[Parameter(Mandatory=$True)]
[System.Data.SqlClient.SqlConnection]$Connection
)
process {
Write-Verbose "Working with database version $($script:databaseVersion)"
# grab original object
$origObject = Get-WEMStorefrontSetting -Connection $Connection -IdStorefrontSetting $IdStorefrontSetting
# only continue if the action was found
if (-not $origObject) {
Write-Warning "No Storefront Setting Object found for Id $($IdStorefrontSetting)"
Return
}
# build query
$SQLQuery = "DELETE FROM VUEMStorefrontSettings WHERE IdItem = $($IdStorefrontSetting)"
$null = Invoke-SQL -Connection $Connection -Query $SQLQuery
# BUG IN THIS FUNCTIONALITY!
# ChangeLog DOES not get updated when you enter a Storefront Settings object in the WEM Administration Console
# Updating the ChangeLog
New-ChangesLogEntry -Connection $Connection -IdSite $origObject.IdSite -IdElement $IdStorefrontSetting -ChangeType "Delete" -ObjectName $IdStorefrontSetting -ObjectType "Unknown Object" -NewValue "N/A" -ChangeDescription $null -Reserved01 $null
}
}