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 […]