From 25167656481f90356fec972c9c845a4c0770a5b1 Mon Sep 17 00:00:00 2001
From: Nic Ballarini <13786995+nicballarini@users.noreply.github.com>
Date: Thu, 24 Jun 2021 10:05:58 -0500
Subject: [PATCH 1/4] Update README.md
Made the install a bit more user-friendly. In the event someone runs the install twice, they won't receive an error.
---
README.md | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index c95bc59..43f14ae 100644
--- a/README.md
+++ b/README.md
@@ -11,13 +11,27 @@ Set volume and mute state of default audio device (playback/recording)
## Import Cmdlet to PowerShell
-Download AudioDeviceCmdlets.dll
+You can choose to manually download AudioDeviceCmdlets.dll
```powershell
-New-Item "$($profile | split-path)\Modules\AudioDeviceCmdlets" -Type directory -Force
-Copy-Item "C:\Path\to\AudioDeviceCmdlets.dll" "$($profile | split-path)\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll"
-Set-Location "$($profile | Split-Path)\Modules\AudioDeviceCmdlets"
-Get-ChildItem | Unblock-File
-Import-Module AudioDeviceCmdlets
+# Setup
+# Checks if the module is installed, if not, will download from v3.0 release and install the module.
+if (!(get-module -name AudioDeviceCmdlets)) {
+ $modulePath = "$($profile | split-path)\Modules\AudioDeviceCmdlets"
+ $fileName = "AudioDeviceCmdlets.dll"
+ $dllURL = "https://github.com/frgnca/AudioDeviceCmdlets/releases/download/v3.0/$fileName"
+ $dllDownloadPath = "$env:USERPROFILE\Downloads\$fileName"
+ $dllDestinationPath = "$modulePath\$fileName"
+ if (!(test-path $dllDownloadPath)) {
+ Invoke-WebRequest -Uri $dllURL -OutFile $dllDownloadPath
+ }
+ if (!(Test-Path $modulePath)) {
+ New-Item $modulePath -Type directory -Force
+ }
+ Copy-Item $dllDownloadPath $dllFilePath
+ Set-Location $modulePath
+ Get-ChildItem | Unblock-File
+ Import-Module AudioDeviceCmdlets -Force
+}
```
From efee0ebdaaed72281d7a03f6bb4fd2c248555588 Mon Sep 17 00:00:00 2001
From: Nic Ballarini <13786995+nicballarini@users.noreply.github.com>
Date: Thu, 24 Jun 2021 10:50:46 -0500
Subject: [PATCH 2/4] Update README.md
add function to grab the latest dll from the repo and tweaked the installation
---
README.md | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 43f14ae..0d0fd10 100644
--- a/README.md
+++ b/README.md
@@ -15,10 +15,20 @@ You can choose to manually download
Date: Thu, 24 Jun 2021 10:54:56 -0500
Subject: [PATCH 3/4] Update README.md
updated description of script
---
README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 0d0fd10..a8ec205 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Set volume and mute state of default audio device (playback/recording)
## Import Cmdlet to PowerShell
-You can choose to manually download AudioDeviceCmdlets.dll
+Run the script below for a hands-free installation. This will get the latest dll asset, create the module directory and install the module.
```powershell
# Setup
# Checks if the module is installed, if not, will download from v3.0 release and install the module.
@@ -40,7 +40,6 @@ if (!(get-module -name AudioDeviceCmdlets)) {
Copy-Item $dllDownloadPath $dllDestinationPath
Set-Location $modulePath
Get-ChildItem | Unblock-File
- start-sleep -s 3
Import-Module AudioDeviceCmdlets -force
}
```
From 5914bfa5bc433fc34873880c7c8105a180fbea77 Mon Sep 17 00:00:00 2001
From: Nic Ballarini <13786995+nicballarini@users.noreply.github.com>
Date: Thu, 24 Jun 2021 11:29:58 -0500
Subject: [PATCH 4/4] Update README.md
added uri type to $download
---
README.md | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index a8ec205..9caf707 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ function Get-LatestGitHubVersion {
$releases = "https://api.github.com/repos/$repo/releases"
$releases
- $downloadURL = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets[0].browser_download_url
+ [uri]$downloadURL = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].assets[0].browser_download_url
return $downloadURL
}
@@ -31,9 +31,7 @@ if (!(get-module -name AudioDeviceCmdlets)) {
$dllURL = Get-LatestGitHubVersion
$dllDownloadPath = "$env:USERPROFILE\Downloads\$fileName"
$dllDestinationPath = "$modulePath\$fileName"
- if (!(test-path $dllDownloadPath)) {
- Invoke-WebRequest -Uri $dllURL -OutFile $dllDownloadPath
- }
+ Invoke-WebRequest -Uri $dllURL -OutFile $dllDownloadPath
if (!(Test-Path $modulePath)) {
New-Item $modulePath -Type directory -Force
}