Skip to content

Commit

Permalink
Merge pull request #115 from royalapplications/transform-microsoft-sa…
Browse files Browse the repository at this point in the history
…mples-to-rdfx

[Refactor] Transform all microsoft samples to rdfx
  • Loading branch information
eiabea authored Dec 14, 2024
2 parents aa383d8 + 280a3cb commit f54148d
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 2 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<DynamicFolderExport>
<Name>Dynamic Folder Export</Name>
<Objects>
<DynamicFolderExportObject>
<Type>DynamicFolder</Type>
<Name>CurrentAccount (Windows PowerShell)</Name>
<Description>This returns dynamic objects reflecting data from the current user account.</Description>
<Notes><![CDATA[<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">.cs2654AE3A{text-align:left;text-indent:0pt;margin:0pt 0pt 0pt 0pt}
.cs4306042E{color:#000000;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:bold;font-style:normal;}
.csC8F6D76{color:#000000;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:normal;font-style:normal;}
.cs15B7AE4B{text-align:left;margin:0pt 0pt 0pt 0pt;list-style-type:disc;color:#000000;background-color:transparent;font-family:Arial;font-size:11pt;font-weight:normal;font-style:normal}
</style>
<p class="cs2654AE3A"><span class="cs4306042E">Version:</span><span class="csC8F6D76"> 1.0</span></p>

<p class="cs2654AE3A"><span class="cs4306042E">Requirements</span></p>

<p class="cs2654AE3A"><span class="csC8F6D76">&nbsp;</span></p>

<ul style="margin-top:0;margin-bottom:0;">
<li class="cs15B7AE4B"><span class="csC8F6D76">Working PowerShell installation</span></li>
<li class="cs15B7AE4B"><span class="csC8F6D76">PowerShell Script Interpreter correctly configured in Royal TS/X</span></li>
</ul>
]]></Notes>
<ScriptInterpreter>powershell</ScriptInterpreter>
<Script><![CDATA[$ErrorActionPreference = "Stop"

# get data
$account = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$domain = $account.split("\")[0]
$username = $account.split("\")[1]

# output objects
@{
Objects = @(
@{
ID = "CURRENT_DOMUSER";
Type = "Credential";
Name = "Current UserName with domain";
Username = $account;
Password = "";
Path = "/";
IconName = "VMware Clarity/Core/Avatar Solid";
Description = "This reflects the current logged-on user account, including domain.";
CustomProperties = @{
DOMAIN = $domain;
USERNAME = $username;
}
},
@{
ID = "CURRENT_USERNAME";
Type = "Credential";
Name = "Current UserName without domain";
Username = $username;
Password = "";
Path = "/";
IconName = "VMware Clarity/Core/Avatar Line";
Description = "This reflects the current logged-on user account, without domain.";
CustomProperties = @{
DOMAIN = $domain;
}
}
)
} | ConvertTo-Json -Depth 10 | Write-Host
]]></Script>
<DynamicCredentialScriptInterpreter>json</DynamicCredentialScriptInterpreter>
</DynamicFolderExportObject>
</Objects>
</DynamicFolderExport>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<DynamicFolderExport>
<Name>Dynamic Folder Export</Name>
<Objects>
<DynamicFolderExportObject>
<Type>DynamicFolder</Type>
<Name>LAPS (deprecated) (Windows PowerShell)</Name>
<Notes><![CDATA[<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">.cs2654AE3A{text-align:left;text-indent:0pt;margin:0pt 0pt 0pt 0pt}
.csAF99984B{color:#000000;background-color:transparent;font-family:Calibri;font-size:14pt;font-weight:bold;font-style:normal;}
.csC8F6D76{color:#000000;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:normal;font-style:normal;}
.cs26DADAAD{color:#000000;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:normal;font-style:normal;text-decoration: none;}
.csCCA9035D{color:#0000FF;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:normal;font-style:normal;text-decoration: underline;}
.csCB8A910D{color:#000000;background-color:transparent;font-family:Calibri;font-size:12pt;font-weight:bold;font-style:normal;}
.cs9579B52F{color:#3C3C3C;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:bold;font-style:italic;}
.cs56A2682C{color:#3C3C3C;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:normal;font-style:normal;}
.cs747BF1FB{color:#000000;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:bold;font-style:italic;}
.cs6DC30935{color:#3C3C3C;background-color:transparent;font-family:Calibri;font-size:11pt;font-weight:normal;font-style:normal;text-decoration: none;}
</style>
<p class="cs2654AE3A"><span class="csAF99984B">Local Administrator Password Solution (LAPS)</span></p>

<p class="cs2654AE3A"><span class="csC8F6D76">&nbsp;</span></p>

<p class="cs2654AE3A"><span class="csC8F6D76">More information on LAPS can be found here:<br />
<a class="cs26DADAAD" href="https://www.microsoft.com/en-us/download/details.aspx?id=46899"><span class="csCCA9035D">https://www.microsoft.com/en-us/download/details.aspx?id=46899</span></a></span></p>

<p class="cs2654AE3A"><span class="csC8F6D76">&nbsp;</span></p>

<p class="cs2654AE3A"><span class="csCB8A910D">Requirements:</span></p>

<p class="cs2654AE3A"><span class="csC8F6D76">The dynamic credential script executes the </span><span class="cs9579B52F">Get-AdmPwdPassword</span><span class="cs56A2682C"> cmdlet of the </span><span class="cs9579B52F">AdmPwd</span><span class="cs747BF1FB">.</span><span class="cs9579B52F">PS</span><span class="cs56A2682C"> module:<br />
<a class="cs6DC30935" href="https://www.powershellgallery.com/packages/AdmPwd.PS"><span class="csCCA9035D">https://www.powershellgallery.com/packages/AdmPwd.PS</span></a></span></p>

<p class="cs2654AE3A"><span class="cs56A2682C">Make sure the module is installed/available on your system!</span></p>

<p class="cs2654AE3A"><span class="csC8F6D76">&nbsp;</span></p>

<p class="cs2654AE3A"><span class="csCB8A910D">Configuration:</span></p>

<p class="cs2654AE3A"><span class="csC8F6D76">The dynamic folder script creates a list of available machine from the Active Directory. Configure the </span><span class="cs747BF1FB">SearchBase</span><span class="csC8F6D76"> path in the </span><span class="cs747BF1FB">Custom Properties</span><span class="csC8F6D76">.</span></p>
]]></Notes>
<CustomProperties>
<CustomProperty>
<Name>SearchBase</Name>
<Type>Text</Type>
<Value>TODO</Value>
</CustomProperty>
</CustomProperties>
<ScriptInterpreter>powershell</ScriptInterpreter>
<Script><![CDATA[$ErrorActionPreference = "Stop"

[string] $JSON = "{ `"Objects`" : [ `n"

$JSON += "{`n"
$JSON += " `"Type`" : `"DynamicCredential`",`n"
$JSON += " `"Name`" : `"Administrator`",`n"
$JSON += " `"ID`" : `"LAPS`"`n"
$JSON += "},`n"

foreach ($comp in (Get-ADComputer -SearchBase $CustomProperty.SearchBase$ -filter *))
{
$JSON += "{`n"
$JSON += " `"Type`" : `"RemoteDesktopConnection`",`n"
$JSON += " `"Name`" : `"$($comp.Name)`",`n"
$JSON += " `"ComputerName`" : `"$($comp.DNSHostName)`",`n"
$JSON += " `"Path`" : `"Connections`",`n"
$JSON += " `"CredentialID`" : `"LAPS`"`n"
$JSON += "},`n"
}

$JSON = $JSON.Substring(0, $JSON.Length - 2)
$JSON += "`n]`n}`n"

Write-Host $JSON]]></Script>
<DynamicCredentialScriptInterpreter>powershell</DynamicCredentialScriptInterpreter>
<DynamicCredentialScript><![CDATA[$ErrorActionPreference = "Stop"

Import-Module AdmPwd.PS

$Pass = Get-AdmPwdPassword -Computername $Target.Name$

$JSON = ""
$JSON += "{`n"
$JSON += " `"Username`" : `".\\Administrator`",`n"
$JSON += " `"Password`" : `"$($Pass.Password)`"`n"
$JSON += "}`n"

Write-Host $JSON


]]></DynamicCredentialScript>
</DynamicFolderExportObject>
</Objects>
</DynamicFolderExport>

0 comments on commit f54148d

Please sign in to comment.