Category Archives: Powershell

Disable TLS 1.0, TLS 1.1 and weak ciphers with Powershell

Posted in Powershell, Windows | Comments Off on Disable TLS 1.0, TLS 1.1 and weak ciphers with Powershell

Powershell JEA Just Enough Administration Session client IP

To get the IP from inside a session you can use Get-WSManInstance. If you run the endpoint as a group managed service account it has to be administrator on the local machine. Otherwise you will get access denied. The variable … Continue reading

Posted in Powershell | Tagged , | Comments Off on Powershell JEA Just Enough Administration Session client IP

Powershell Hash and Arrays

Two ways of making a table of hash tables and arrays. [codesyntax lang=”powershell”] #Alt1 $Array = New-Object System.Collections.ArrayList #Foreach () { $Hash = New-Object -TypeName PSObject -Property @{ Status = “Ok” DisplayName = “Test” } $Array.Add($Hash) | Out-Null Remove-Variable $Hash -ErrorAction … Continue reading

Posted in Powershell | Comments Off on Powershell Hash and Arrays

Powershell – Path and filename

[codesyntax lang=”powershell”] [io.path]::GetFileNameWithoutExtension(“c:\temp\myfile.txt”) [io.path]::GetDirectoryName(“c:\temp\myfile.txt”) [io.path]::GetTempPath() [/codesyntax]Some simple examples on how to get filename and folder out of a path with powershell and .Net

Posted in Powershell | Comments Off on Powershell – Path and filename

Check local certificate store for expired certificate

This script looks inside local machine certificate store for expired certificates. If found, it writes to the event log. [codesyntax lang=”powershell”] $ThresholdWarning = “60” #Set warning date $ThresholdError = “30” #Set error date New-EventLog -Source PKI -LogName Application -ErrorAction:SilentlyContinue $Certs … Continue reading

Posted in Powershell, Uncategorized | Comments Off on Check local certificate store for expired certificate

Search inside Powershell scripts

[codesyntax lang=”powershell”] Cls #Path $Files = Get-ChildItem “Path to your scripts i.e C:\Powershell” -File Foreach ($File in $Files) { $SearchString = “*Text*” #Enter search pattern here If (Select-String -Path $File -Pattern $SearchString) {Write-Host “Found $SearchString in $File $(($File.LastWriteTime).DateTime)”} } [/codesyntax]

Posted in Powershell | Comments Off on Search inside Powershell scripts

Signera powershellscript

#Här väljer du om du vill hämta certet från Store eller från fil, kommentera bort det som du vill använda. #För att hämta ut certifikatets thumbprint körs enklast #Dir Cert:CurrentUser/My $Cert=(dir Cert:CurrentUser\My\673B9FB4FB236E5667AA17886B348DABD4C036) #$Cert = Get-PfxCertificate ‘C:\Temp\CodeSigningCertificate.pfx’ #Timestamp används för att … Continue reading

Posted in Powershell | Comments Off on Signera powershellscript

Installation .net 3.5.1 i Windows Server 2012

Continue reading

Posted in Powershell, Windows | Comments Off on Installation .net 3.5.1 i Windows Server 2012

Sätta advanced settings på virtuella maskiner under drift

Continue reading

Posted in Powershell, Vmware | Tagged , , , , | Comments Off on Sätta advanced settings på virtuella maskiner under drift

Group Policy – Rensa säkerhetsfilter med Powershell

Continue reading

Posted in Powershell | Tagged , , , | Comments Off on Group Policy – Rensa säkerhetsfilter med Powershell