PowerShell - Suppress stderr output

stderr to null @ $commandWithArgs 2>&1 | out-null or @ $commandWithArgs --quiet --no-verbose > $null 2>&1 all output to null @ $commandWithArgs *> | $null

Windows - MMC Command Line Shortcuts

Admin Applet Command AD Domains and Trusts domain.msc Active Directory Management admgmt.msc AD Sites and Services dssite.msc AD Users and Computers dsa.msc ADSI Edit adsiedit.msc Authorization manager azman.msc Certification Authority Management certsrv.msc Certificate Templates certtmpl.msc Cluster Administrator cluadmin.exe Computer Management compmgmt.msc Component Services comexp. [Read more...]

Windows - Get File Checksum

Get Checksum (Hash) of File on Windows Use a built-in way to get file checksums from the command line in Windows. Use the following syntax to get the SHA1 checksum of a file. certutil -hashfile <filename> SHA1 Help Running the following command certutil -hashfile -? Will show all the options and usage for the -hashfile verb. Luckily, certutil supports the deprecated MD5 hash, which is not good for security but still has value in certain areas of IT. [Read more...]

Hugo - Syntax Highlighting

In order to get fancy higlighting like this: SELECT * FROM TBL_1 GO Console.Writeline("Hello World"); You either need to use the Highlight Shortcode or enable code fences in the configuration file. Add this line pygmentsCodeFences = true To config.toml To be able to use something like ```sql-- My code here ```to wrap code syntax. Alternatively, with the Highlight Shortcode you can do something like this: {{< highlight sql "linenos=table,hl_lines=8 15-17,linenostart=199" >}} SELECT * FROM TBL_1 GO {{< / highlight >}} Which results in this: [Read more...]

Powershell - Update a certificate friendly name

function Legacy-UpdateFriendlyName { param( [parameter(Mandatory = $true, ValueFromPipeLine= $true)] [string]$Name, [parameter(Mandatory = $true)] [string]$FriendlyName, [ValidateSet("FindByThumbprint", "FindBySubjectName", "FindBySubjectDistinguishedName", "FindByIssuerName", "FindByIssuerDistinguishedName", "FindBySerialNumber", "FindByTimeValid", "FindByTimeNotYetValid", "FindByTimeExpired", "FindByTemplateName", "FindByApplicationPolicy", "FindByCertificatePolicy", "FindByExtension", "FindByKeyUsage", "FindBySubjectKeyIdentifier")] [string]$Type = "FindByThumbprint" ) $store = New-Object System.Security.Cryptography.X509Certificates.X509Store $store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::MaxAllowed) Try { $certificates = $store.Certificates.Find($type,$name,$false) if( -not([string]::IsNullOrEmpty($certificates)) ) { foreach($cert in $certificates) { $cert.FriendlyName = $FriendlyName # + " - " + $cert.Subject #$cert } } else { Write-Warning "No Certificates found" } } Catch { $error[0] } $store. [Read more...]

Firefox - Can't log into SSRS Web Portal NTLM

If you keep getting prompted by Firefox for your logon credentials, then the logon goes away and pops right back up, try the following fix. Enter about:config in Firefox Find the setting network.automatic-ntlm-auth.trusted-uris Edit it to include the URL of your reporting server Additional NOTES: To do something like adding the intranet zone you may also have to edit network.automatic-ntlm-auth.allow-non-fqdn to true You can add an entire domain by adding: [Read more...]

SSH - Secure VPS With Certificate

Secure VPS with Certificate SSH Generate a new key on the machine that is to access the VPS ssh-keygen -a 1000 -b 4096 -C "" -o -t rsa or ssh-keygen -a 1000 -C "" -o -t ed25519 -a specifies # of KDF rounds -b specifies the bit size for RSA keys -C removes the common comment at the end of the key -o specifies that we should use the new format provided by OpenSSH -t specifies the key type (RSA) Copy key to the VPS Copy the public key to the VPS [Read more...]

Windows - Deleting Protected Folders

Let’s say you have some user folders or some other such folder (or file) in Windows that you need to delete, but you get an unauthorized access error. There are a couple of things you need to do before you can remove a protected folder/file. This process assumes you are part of the Administrators group. Also, run the command prompt as admin when running these commands. Take ownership Grant permissions Remove the folder Take Ownership [Read more...]