Archive for the ‘Powershell’ Category

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()}

Configuring NIC Teaming in Powershell on Windows Server 2012 – Powershell

Friday, February 15th, 2013

The first thing you’ll need to do is see what network adapters you currently have setup.

Type: “Get-NetAdapter” to get the list of network interfaces.

Now with this information we can create the NIC team.

Type: “New-NetlbfoTeam” to start the creation process.

You will be asked for the “TeamMembers” that will be apart of the NIC team one by one. Enter the NIC names i.e. “Ethernet” then hit enter. When there are no more team members to add just hit enter while the current “TeamMember” prompt is empty.

You will be asked to confirm the information and once you hit “Enter” or type “Y”