Category Archives: PowerShell

Remove Dell Bloatware

By | October 20, 2024

This removes all Dell apps except Command Update $apps = Get-WmiObject win32_product | ? {$_.vendor -like “Dell*” -and $_.name -notlike “Dell Command*”};$apps foreach($app in $apps){ $Result = $app.uninstall() | Select-Object -Property returnvalue if(($Result).returnvalue -eq 0){Write-host $app.name}Else{Write-host “$PC Fail”}}

Start Menu and Taskbar Issues

By | September 13, 2023

If the start menu stops opening or you cannot use icons from the taskbar, you can reinstall the Windows taskbar: Press Windows Key+X > Click Powershell (Admin) > Copy the below and paste into Powershell > Enter > Reboot your computer Get-AppXPackage -Name Microsoft.Windows.ShellExperienceHost | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”} To restart the explorer: Press CTRL+SHIFT+ESC > Locate… Read More »

Block Outlook from connecting to 365

By | August 10, 2021

Beginning with Office 2016 Outlook auto-connects to 365 upon opening. This causes users to be prompted for credentials if their account is on-premise. To disable this,  run this in PowerShell as the user: Set-ItemProperty -Path HKCU:\software\Microsoft\Office\16.0\Outlook\AutoDiscover -Name ‘ExcludeExplicitO365Endpoint’ -Value 1 -Type DWord -Force

Keep Mapped Location Open

By | November 22, 2020

If windows continually drops a remote location you can keep it open with this: do{start-process \\server\path ;start-sleep 5 $a = (New-Object -comObject Shell.Application).Windows() |?{$_.FullName -ne $null} |? {$_.FullName.toLower().Endswith(‘\explorer.exe’)} $a | % {  $_.Quit() }Start-sleep 3600}while ($True)

Set Network Type

By | July 16, 2019

To change the network type in windows 10 from Public to Private: $Name = Get-NetConnectionProfile|Select Name |out-gridview -PassThru Set-NetConnectionProfile -Name $Name.name -NetworkCategory Private

Making PowerShell Interactive

By | January 11, 2019

Turn a Powershell script into an interactive application with: Out-GridView -PassThru | This code will pause your script and present you the data collected in a grid view. You can then select specific items in that view. When you hit OK at the bottom the script will proceed against just the selected items.

AnyConnect Password

By | August 23, 2018

The Cisco Any Connect Client does not allow you to save a password on the client. This code when saved as a .vbs file will let you get around this.  Be warned that the client’s password is saved in clear text in the file. I hide the file in Drivers and create a shortcut to it with the… Read More »

Exchange Permissions

By | August 16, 2018

You can list all users with Mailbox permissions with this in PowerShell: Get-Mailbox | Get-MailboxPermission | where {$_.user.tostring() -ne “NT AUTHORITY\SELF” -and $_.IsInherited -eq $false} | Select Identity,User | Export-Csv -NoTypeInformation mailboxpermissions.csv

Safe Mode from CMD

By | April 8, 2018

If you need to put a system into safe mode you can do this from cmd then reboot: This will set the safemode switch: bcdedit /set {current} safeboot minimal with networking: bcdedit /set {current} safeboot network to put back in normal mode via dos: bcdedit /deletevalue {current} safeboot

Remote log off

By | March 20, 2018

I recently had a console session hang with just a white screen and no start menu on an Exchange Server. Not wanting to reboot the server and disrupt the entire office, I used the following to remotely log the admin out via PowerShell: (gwmi win32_operatingsystem -ComputerName $PCname).Win32Shutdown(4)

Network XP & 10

By | December 28, 2017

Hopefully this doesn’t come up often but when it does… Windows 10 no longer supports SMB1. It can be enabled (it is also a big security hole) Powershell as administrator: Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol more on the topic in general here.

Exchange Email Format

By | May 9, 2017

In Exchange, emails sent outside the organization are converted and the format of these can be set per domain or for all domains. If messages are sent in text format, some recipients will have issues viewing attached images. ContentType should be MimeHtmlText not MimeText when running: Get-RemoteDomain |fl To update it run the following with either a domain… Read More »

Clean All Temp Folders

By | February 28, 2017

$tempfolders = @(“C:\Windows\Temp\*”, “C:\Windows\Prefetch\*”, “C:\Documents and Settings\*\Local Settings\temp\*”, “C:\Users\*\Appdata\Local\Temp\*”,”C:\ProgramData\Microsoft\Windows\WER\ReportArchive\*”); Remove-Item $tempfolders -force -recurse

Exporting Mailboxes

By | January 18, 2017

You can export entire mailboxes (smaller than 50GB) to PST, from the Exchange console: New-MailboxExportRequest -Mailbox “Amy Smith” -FilePath “\\Server\Share\AmySmith.pst” To get Status of the request: Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | fl These should be output to a fast drive with plenty of capacity (not a shadow copy volume). When decommissioning a user account move the file  to the… Read More »

Disable Hibernation

By | October 18, 2015

Windows default has hibernation turned on. This take good piece of the hard drive in the form of the hiberfil.sys file which takes up about as much c drive space as there is RAM installed. To dispose of the file and disable hibernation instantly use this in PowerShell: powershell -Command “Start-Process ‘powercfg.exe’ -Verb runAs -ArgumentList ‘/h off'”

Search for PSTs

By | March 18, 2015

Before removing a drive from service or when moving a user to a new system, it is important to verify no PSTs have been left behind. To find all PSTs launch ISE as admin then run: Get-ChildItem -path c:\users\ -force -Recurse -filter ‘*.pst’ -erroraction ‘silentlycontinue’ | select name, Length, LastWriteTime, directory #Run as admin