44 lines
806 B
PowerShell
44 lines
806 B
PowerShell
|
|
<#
|
||
|
|
Author: Gabe Kerntke
|
||
|
|
Date: 03-10-2025
|
||
|
|
|
||
|
|
.Synopsis
|
||
|
|
|
||
|
|
.Modified
|
||
|
|
2025-03-10 (GabeK) - Original script created
|
||
|
|
|
||
|
|
#>
|
||
|
|
|
||
|
|
# Variables #
|
||
|
|
|
||
|
|
$soundPlayer = New-Object System.Media.SoundPlayer
|
||
|
|
$DisconnectSound = "C:\Windows\Media\Windows Hardware Remove.wav"
|
||
|
|
$ConnectSound = "C:\Windows\Media\Windows Hardware Insert.wav"
|
||
|
|
|
||
|
|
# Functions #
|
||
|
|
|
||
|
|
Function USBSound {
|
||
|
|
$soundPlayer.SoundLocation = $DisconnectSound
|
||
|
|
$soundPlayer.Play()
|
||
|
|
|
||
|
|
Start-Sleep 2
|
||
|
|
|
||
|
|
$soundPlayer.SoundLocation = $ConnectSound
|
||
|
|
$soundPlayer.Play()
|
||
|
|
}
|
||
|
|
|
||
|
|
Function LoopUSBSound {
|
||
|
|
for ($i = 0; $i -lt 3; $i++) {
|
||
|
|
Start-Sleep 5
|
||
|
|
USBSound
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
# Start Script #
|
||
|
|
|
||
|
|
Add-Type -AssemblyName System.Windows.Forms
|
||
|
|
Add-Type -AssemblyName PresentationFramework
|
||
|
|
|
||
|
|
LoopUSBSound
|
||
|
|
|
||
|
|
# End Script #
|