Transform a PowerShell Object with empty properties to an Hashtable with only properties that have value

Hi guys, Some time you may want to use PowerShell splating instead of PipeLine input. Splating, is the action to add some parameters to a cmdlet directly by giving the cmdlet a hashtable with properties and values. Here, as an example, the creation of an MsolUser using splating for my cat: Sometime, when you use […]

Use PowerShell to decrypt password stored in a RDG file

Hello, If, like a colleague, you forget frequently the passwords you stored in your RDG file. There is a way to decrypt the secured string using the RDCMan.exe file. First you need to copy the RDCMan.exe and change the extension to “dll” (“RDCMan.dll”). [ps]Copy-Item ‘C:\Program Files (x86)\Microsoft\Remote Desktop Connection Manager\RDCMan.exe’ ‘C:\temp\RDCMan.dll’ Import-Module ‘C:\temp\RDCMan.dll’ $EncryptionSettings = […]

How to get the Krbtgt last password set value using powershell

Hello, For a script purpose I needed to have the date of the last password set of the Krbtgt account. To do so I wrote this PowerShell function: [ps] Function Get-ADKrbtgtPwdLastSet{ [CmdletBinding()] Param( [Parameter(Mandatory=$false, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, HelpMessage=’Name of the domain.’, Position=0)] [ValidateScript({Test-Connection -ComputerName $_ -Count 2 -Quiet})] [String]$DomainName = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name ) Begin{ } Process{ $RodcKrbtgtSearcher […]

Store PowerShell Credentials in a XML File

Hello, Here is the fastest and easiest way to store, “as secure as possible”, Credentials in a XML File. Get-Credential | Export-Clixml -Path “$Path\Credentials.xml” Alternativly, you can also use Read-Host to prompt for input. $UserName = Read-Host ‘Enter Username’ $Password = Read-Host ‘Enter Password’ -AsSecureString New-Object System.Management.Automation.PSCredential ($UserName, $Password) | Export-Clixml -Path “$Path\Credentials.xml” The stored […]

Run a FIM 2010 R2 specific Management Agent with PowerShell

Hello, Here is a cmdlet I to start a selected Management Agent with a specific Run Profil. (Get-WmiObject -ComputerName $FIMSyncServer -NameSpace ‘root/MicrosoftIdentityIntegrationServer’ -Class ‘MIIS_ManagementAgent’ | Where-Object { $_.Name -eq $ManagementAgent }).Execute($RunProfile)

List FIM 2010 R2 Management Agents with PowerShell

Hello, Here is the cmdlet to list FIM Sync Management Agents. Get-WmiObject -ComputerName ‘FIMSyncServer’ -NameSpace ‘root/MicrosoftIdentityIntegrationServer’ -Class ‘MIIS_ManagementAgent’