Skip to content

Instantly share code, notes, and snippets.

View rysstad's full-sized avatar

Tor Arne Rysstad rysstad

View GitHub Profile
#Requires -RunAsAdministrator
# Disables certificate CRL checking on Windows Server 2008 R2
# More info here: http://blogs.msdn.com/b/chaun/archive/2014/05/01/best-practices-for-crl-checking-on-sharepoint-servers.aspx
$HKEYUSERS = get-childitem $(Resolve-Path Registry::HKEY_USERS\)
foreach ($userKey in $HKEYUSERS) {
$RegPath = $userKey.PSPath
$RegPath = $RegPath + "\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing\"
if ($(Test-Path $RegPath)) {
@rysstad
rysstad / List-InstalledSoftware.ps1
Created February 28, 2015 01:28
List installed software
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize
@rysstad
rysstad / List-InstalledDrivers.ps1
Created February 28, 2015 00:53
List InstalledDrivers
Get-WmiObject Win32_PnPSignedDriver | Select-Object DeviceName, DriverVersion
@rysstad
rysstad / Disable-WPAD.ps1
Created February 28, 2015 00:32
Disable WPAD in Internet Explorer on Windows Server 2008 R2
#Requires -RunAsAdministrator
# Disables IE WPAD on Windows Server 2008 R2
$HKEYUSERS = get-childitem $(Resolve-Path Registry::HKEY_USERS\)
foreach ($userKey in $HKEYUSERS) {
$RegPath = $userKey.PSPath
$RegPath = $RegPath + "\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\"
if ($(Test-Path $RegPath)) {
$wpadSetting = (Get-ItemProperty -LiteralPath $RegPath).DefaultConnectionSettings
@rysstad
rysstad / Sharepoint-DeveloperDashboard.ps1
Created February 19, 2015 14:32
Set Sharepoint DeveloperDashboard DisplayLevel
# Set Sharepoint DeveloperDashboard DisplayLevel to On
$DeveloperDashboard = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings
$DeveloperDashboard.DisplayLevel = 'On'
$DeveloperDashboard.TraceEnabled = $true
$DeveloperDashboard.Update()
# Turn off Sharepoint DeveloperDashboard
$DeveloperDashboard = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings
$DeveloperDashboard.DisplayLevel = 'Off'
$DeveloperDashboard.TraceEnabled = $False
@rysstad
rysstad / Install-MSIPackage.ps1
Last active April 24, 2024 11:49
Install MSI package silently with powershell
$msiPackageToInstall = "<path to .msi>"
# save log from installation to temp file
$tmpFile = [System.IO.Path]::GetTempFileName()
Start-Process msiexec -ArgumentList "/i $msiPackageToInstall /qn /L*v $tmpFile" -NoNewWindow -Wait
@rysstad
rysstad / Get-CommandAllAvailable.ps1
Created February 4, 2015 11:10
Get list of all available cmdlets, functions, aliases and workflows
Get-Command -All | Select-Object Name, CommandType, ModuleName, PSSnapIn, HelpUri
@rysstad
rysstad / Get-ProsentageThePowershellWay.ps1
Last active August 29, 2015 14:14
Get-ProsentageThePowershellWay
# Use the method .tostring("P"), for example:
$a = [math]::PI
$b = [math]::E
($a/$a).tostring("P")
@rysstad
rysstad / Get-LastBootTime
Created January 8, 2015 14:04
Function that returns last boot time and date as System.DateTime
function Get-LastBootTime {
# returns last boot time and date as System.DateTime
(Get-Date) - $([timespan]::FromMilliseconds([Environment]::TickCount ) )
}
@rysstad
rysstad / Get-DirectorySize
Created January 1, 2015 21:36
Get size of folder and sub-folders
$dirSize = (Get-ChildItem -file -Recurse | Measure-Object length -sum).sum/1mb
$dirSize = [math]::Round($dirSize)
Write-Output "$(Get-Location): $dirSize Mb"