Archive for the ‘Powershell’ Category

Use PowerShell to parse event log for shutdown events

Thursday, March 6th, 2025

Get-EventLog -LogName system -Source user32 -Newest 1 | fl *

Remove the Outlook Auto-mapping for an Exchange Mailbox?

Thursday, February 6th, 2025

Add-MailboxPermission -Identity -User -AccessRights FullAccess -AutoMapping $false

Set a default printer – Powershell

Thursday, December 21st, 2023
$Printer = Get-CimInstance -Class Win32_Printer -Filter "Name='Samsung M337x'"
Invoke-CimMethod -InputObject $Printer -MethodName SetDefaultPrinter 

Change timestamp on file

Friday, February 12th, 2021

(Get-Item “FILE PATH”).LastWriteTime=(“31-12-2021 15:00:00”)

Fix and/or Reinstall Windows Store

Wednesday, February 10th, 2021

Open Start, type: powershell
Right click PowerShell
Click Run as administrator

At the command prompt, type the following then hit Enter:

Get-AppXPackage *WindowsStore* -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}

Exit Powershell then restart.

Check if you can open the Store.

Nuvoton SIO CIR Device Driver

Saturday, June 23rd, 2018

Disable-PnpDevice “ACPI\NTN0530\0” -Confirm:$false

Winmail.dat – exchange 2010 MailContact

Thursday, May 17th, 2018

Set-MailContact -UseMapiRichTextFormat:Never

Loop 3 times times – Powershell

Wednesday, April 19th, 2017
for ($i=1; $i -le "3"; $i++)
{
"Loop"
}

 

Wait for a Service to reach a specified status

Sunday, November 24th, 2013
$svc = Get-Service W3SVC
while($svc.State -ne 'Stopped')
{
   Start-Sleep -Seconds 1
}

... do your thing here...

remove all network printers

Wednesday, March 13th, 2013

Get-WMIObject Win32_Printer | where{$_.Network -eq ‘true’} | foreach{$_.delete()}