Skip to content

Instantly share code, notes, and snippets.

View krzydoug's full-sized avatar

Doug Maurer krzydoug

  • Software Consulting Services
View GitHub Profile
@krzydoug
krzydoug / gist:e598e02ddcbf586730ce6b4851269095
Created September 25, 2024 07:59
Remove-GhostedDevice.ps1
<#
.SYNOPSIS
Removes ghost devices from your system
.DESCRIPTION
This script will remove ghost devices from your system. These are devices that are present but have an "InstallState" as false. These devices are typically shown as 'faded'
in Device Manager, when you select "Show hidden and devices" from the view menu. This script has been tested on Windows 2008 R2 SP2 with PowerShell 3.0, 5.1, Server 2012R2
with Powershell 4.0 and Windows 10 Pro with Powershell 5.1. There is no warranty with this script. Please use cautiously as removing devices is a destructive process without
an undo.
@{
'e4654015-5daf-4a48-9b37-4f309dddd88b' = 'Advanced Communications'
'd2dea78b-507c-4e56-b400-39447f4738f8' = 'AI Builder Capacity add-on'
'8f0c5670-4e56-4892-b06d-91c085d7004f' = 'App Connect IW'
'9706eed9-966f-4f1b-94f6-bb2b4af99a5b' = 'App governance add-on to Microsoft Defender for Cloud Apps'
'0c266dff-15dd-4b49-8397-2bb16070ed52' = 'Microsoft 365 Audio Conferencing'
'c2cda955-3359-44e5-989f-852ca0cfa02f' = 'Microsoft 365 Audio Conferencing for faculty'
'2b9c8e7c-319c-43a2-a2a0-48c5c6161de7' = 'Microsoft Entra Basic'
'078d2b04-f1bd-4111-bbd4-b4b1b354cef4' = 'Microsoft Entra ID P1'
'30fc3c36-5a95-4956-ba57-c09c2a600bb9' = 'Microsoft Entra ID P1 for faculty'
This file has been truncated, but you can view the full file.
Function Invoke-Log4jScan {
[cmdletbinding()]
Param(
[string[]]$ComputerName
)
begin {
Write-Verbose "Invoke-Log4jScan initializing"
if(-not (Test-Path C:\Temp)){
#initialize
Set-ExecutionPolicy Bypass -Scope CurrentUser -Force
$global:percentcomplete = 0
$global:activity = 'Initializing..'
function write-message{
Param($msg)
Write-Progress -Activity $Global:activity -Status "$msg..." -PercentComplete $global:percentcomplete
}
write-message "Symantec network uninstall script initializing.."
. \\dcserver\Support\Scripts\Get-InstalledPrograms.ps1
Function Get-FileMetaData {
[cmdletbinding()]
Param
(
[parameter(valuefrompipeline,ValueFromPipelineByPropertyName,Position=1,Mandatory)]
$InputObject
)
begin
{
$searchterm = 'intel'
$newmac = 'A0B1C2D3E4F5'
$path = 'HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}'
Push-Location $path
$nic = Get-ChildItem -ea SilentlyContinue | Get-ItemProperty | where driverdesc -like "*$searchterm*"
switch($nic.pspath.count)
Function Get-MailTrafficReport
{
Param
(
[Parameter(Mandatory = $false)]
[switch]$MFA,
[switch]$OnlyOrganizationUsers,
[Nullable[DateTime]]$StartDate,
[Nullable[DateTime]]$EndDate,
[string]$UserName,
Param($one,$two)
write-host $one
write-host $two
# Define the functions
function RevokeRefreshToken
{
$azureADConnected = ConnectToAzureAD
if($azureADConnected -eq $true)
{
$userInput = Read-Host "Press 1 to specify csv file or enter an email address of a specific user"
if($userInput.Equals("1"))
{
$ErrorActionPreference = 'stop'
Clear-Host
"============================================ Drivenotfoundexception ============================================="
try {
Get-Childit
}
# remove the 1st "#" below to disable the 1st catch
#<#
catch [System.Management.Automation.Drivenotfoundexception]