first commit

This commit is contained in:
2025-11-21 17:17:42 +01:00
commit 4cad18c2a5
285 changed files with 122106 additions and 0 deletions
@@ -0,0 +1,39 @@
## Description
This function can be used to set the volume of your targets PC
## The Function
### [Set-Volume]
In this function we will create an object to allow us to use the Send Keys method to either raise or lower the volume using the following syntax
```PowerShell
Set-Volume 50
```
```PowerShell
Function Set-Volume
{
Param(
[Parameter(Mandatory=$true)]
[ValidateRange(0,100)]
[Int]
$volume
)
# Calculate number of key presses.
$keyPresses = [Math]::Ceiling( $volume / 2 )
# Create the Windows Shell object.
$obj = New-Object -ComObject WScript.Shell
# Set volume to zero.
1..50 | ForEach-Object { $obj.SendKeys( [char] 174 ) }
# Set volume to specified level.
for( $i = 0; $i -lt $keyPresses; $i++ )
{
$obj.SendKeys( [char] 175 )
}
}
```