A digital signature is created when a file is run through a hashing algorithm and the resultant hash (digest / fingerprint) is then signed by a private key. If an application wants to check the integrity of a file, it can perform the following steps: Decrypt the signed hash with the corresponding public key Put…
Tag: one-liner
One-Liner: Query the AD Schema for User Object Attributes
I’ve lost count of just how many blog posts have their origin in a customer question. Here’s another: “How do you use PowerShell to get a list of what attributes *could* be populated on an AD user object?” A magnificent question! The customer was unsure as to why some properties would appear…
One-Liner: Get TLS Cipher Suite Details with PowerShell
This one is awesome (and short). (Get-TlsCipherSuite).Name
One-Liner: Find a Renamed and Relocated AD Guest Account WITHOUT using the Well-Known SID
So… someone decided to rename and move the domain’s Guest account. You could find searching via the well-know SID… SID: S-1-5-21domain-501 Name: Guest Description: A user account for people who do not have individual accounts. This user account does not require a password. By default, the Guest account is disabled. Or… you could try this little trick… …
Security Focus: Set ConstrainedLanguage Mode on My Test Computer
Whilst doing some research, for a presentation on Security and PowerShell, I came across what I assume is an UNSUPPORTED setting, due to a lack of documentation: [Environment]::SetEnvironmentVariable(‘__PSLockdownPolicy’, ‘4’, ‘Machine’) After running it, look what happens when I try and start PowerShell. Damn, my profile script won’t run… but, what’s this? I can’t do other…
One-Liner: Use PowerShell to Verify Domain Controller Location
It’s generally a bad thing if a domain controller isn’t in the domain controllers OU. For example, the default domain controllers policy may not be applied. Here’s a cheeky one-liner to check you’re good: Get-ADDomainController -Filter * | ForEach-Object { if ($_.ComputerObjectDN -notmatch “CN=$($_.Name),OU=Domain COntrollers,$($_.DefaultPartition)”) { Write-Output “$($_.Name) computer object DN set to $($_.ComputerObjectDN)” }…
One-Liner: Use PowerShell to Get GPOs Containing User Settings
Last week we used Get-ADObject to find GPOs based on their flags attribute. We targeted GPOs that were configured with user settings enabled and computer settings disabled. This week we’ll find GPOs containing user settings. I’ll show you two ways, the second of which is preferred… Way, the first – Get-GPOReport Get-GPO -All | ForEach-Object {…
One-liner: Use Get-ADObject to Find Authorised DHCP Servers
The DHCP PowerShell module has the Get-DhcpServerInDC cmdlet to show you the DHCP servers that have been authorised in Active Directory. This cmdlet was introduced with Windows Server 2012 and v3 of PowerShell. What if you don't have access to the above? What if you want to impress your PoSh Chickens and get a list of…
One-Liner: Domain Controller Patch Levels
Before performing work against your Active Directoy, it's prudent to complete a few checks, e.g. is replication healthy, are my FSMOs up, do I have up-to-date, verified backups etc? Here's a one-liner to give you a view of whether your patch levels are consistent: Get-ADDomainController -Filter * | ForEach-Object { $HotFixes = (Get-HotFix -ComputerName $_.Name).Count Write-Host "$($_.Name): $($_.OperatingSystem)…
One-Liner: Change Account Lockout Threshold
What's the optimal Account Lockout Threshold value? A question that continues to generate a lot of debate! If an account lockout threshold is set, the latest guidance, issued with Windows Server 2012 R2, suggests a value of 10. Visit this post for more information: Configuring Account Lockout After the new guidance was released, I wanted to quickly and efficiently…