Slackbot
12/10/2020, 5:38 PMJames Rankin
12/10/2020, 5:43 PMJon Rolls
12/10/2020, 5:55 PMtheshadow87
12/11/2020, 8:57 AMDennis van Dam
12/11/2020, 7:52 PMtheshadow87
12/12/2020, 12:08 AMAmir Joseph Sayes
12/12/2020, 10:51 AM#Get the contents of EM config XML file
[xml]$xml = Get-Content -path "C:\temp\EM_Config_shortcuts_15062020\Configuration.xml"
#Function to recurse through Appsense EM XML config and return shortcuts, printers, or mapped drives along with their AD group condition (if any)
Function Recurse_EM_XML
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory=$true)]
[object]$XMLFile,
[ValidateSet("UEM.Action.Drive.Map","UEM.Action.Shortcut","UEM.Action.Printer.Map")]
[string[]]
$LookedForProperty="UEM.Action.Shortcut"
)
#check the identifier name, if matches, collect the AD group name
if ($XMLFile.Identifier -eq "UEM.Condition.UserGroupMembership") {
$ou = ($XMLFile.ActionProperties.ActionProperty | where {$_.name -eq "GroupName"} ).value
}
#check the identifier name - if matches, collect the description and the enable/disable status
if ($XMLFile.Identifier -eq "UEM.Action.Shortcut") {
$description = $XMLFile.description.text
$enabled = $XMLFile.enabled
#Create the final object for output
New-Object -Type PSObject -Property @{
Name = $description
Path = ($XMLFile.ActionProperties.ActionProperty | where {$_.name -eq "TargetPath" }).value
Parameters = ($XMLFile.ActionProperties.ActionProperty | where {$_.name -eq "Parameters" }).value
OU = $OU
Enabled = $Enabled
}
$description = $null
$OU = $null
}
if ($XMLFile.Identifier -eq "UEM.Action.Drive.Map") {
$description = $XMLFile.description.text
$enabled = $XMLFile.enabled
#Create the final object for output
New-Object -Type PSObject -Property @{
Name = $description
#Dive one more layer in to get more properties
DriveLetter = ($XMLFile.ActionProperties.ActionProperty | where {$_.name -eq "DriveLetter" }).value
RemotePath = ($XMLFile.ActionProperties.ActionProperty | where {$_.name -eq "RemotePath" }).value
FriendlyName = ($XMLFile.ActionProperties.ActionProperty | where {$_.name -eq "FriendlyName" }).value
OU = $OU
Enabled = $Enabled
}
$description = $null
$OU = $null
}
if ($XMLFile.Identifier -eq "UEM.Action.Printer.Map") {
$description = $XMLFile.name
$enabled = $XMLFile.enabled
#Create the final object for output
New-Object -Type PSObject -Property @{
Name = $description
Path = ($XMLFile.ActionProperties.ActionProperty | where {$_.name -eq "Path" }).value
#Parameters = ($XMLFile.ActionProperties.ActionProperty | where {$_.name -eq "Parameters" }).value
OU = $OU
Enabled = $Enabled
}
$description = $null
$OU = $null
}
If ($XMLFile.HasChildNodes)
{
$Child_Nodes = $XMLFile.ChildNodes | Where {$_.NodeType -Eq "Element"}
if ($Child_Nodes -ne $null) {
ForEach ($Node In $Child_Nodes)
{
Recurse_EM_XML $Node
}
}
}
}
$res = @()
$res += Recurse_EM_XML -LookedForProperty UEM.Action.Shortcut -XMLFile $xml
$res | Export-Csv -Path C:\temp\shortcuts_extract.csv -Force -NoTypeInformationDennis van Dam
12/12/2020, 10:56 AMDennis van Dam
12/13/2020, 3:37 PMDennis van Dam
12/13/2020, 4:21 PMAmir Joseph Sayes
12/13/2020, 4:27 PMDennis van Dam
12/13/2020, 5:41 PMtheshadow87
12/13/2020, 7:16 PMtheshadow87
12/13/2020, 7:17 PMtheshadow87
12/14/2020, 9:34 AMtheshadow87
12/14/2020, 9:40 AMAmir Joseph Sayes
12/14/2020, 11:31 PMDennis van Dam
12/16/2020, 11:35 AM