frgnca / AudioDeviceCmdlets

AudioDeviceCmdlets is a suite of PowerShell Cmdlets to control audio devices on Windows
MIT License
743 stars 92 forks source link

Getting error during "Import-Module AudioDeviceCmdlets" Operation is not supported. #26

Closed ComDat closed 5 years ago

ComDat commented 5 years ago

Hi there,

I'm hoping to fall in love with this Cmdlet, just can't seem to get the darn thing installed.

Here's the script I'm using to install:

New-Item "$($profile | split-path)\Modules\AudioDeviceCmdlets" -Type directory -Force
Copy-Item "H:\Downloads\AudioDeviceCmdlets.dll" "$($profile | split-path)\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll"
Set-Location "$($profile | Split-Path)\Modules\AudioDeviceCmdlets"
Get-ChildItem | Unblock-File
Import-Module AudioDeviceCmdlets

Here's the error I'm getting, I've replaced my username with "[username]".

Import-Module .\AudioDeviceCmdlets.dll
Import-Module : Could not load file or assembly 'file:///C:\Users\[username]\Documents\WindowsPowerShell\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll' or one of its
dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1

Any ideas where to start troubleshooting the issue?

ComDat commented 5 years ago

In trying to resolve the issue myself, I've found that other people who are having a similar issue, found that unblocking a zip file would allow the file to be unblocked, but if they unzipped, then unblocked, windows would remember that the file was unsafe and not actually unblock it. Is it possible to add it to the master repo so it will be present in a zip file, to troubleshoot?

ComDat commented 5 years ago

Here is where I found the aforementioned source. https://github.com/azureautomation/azure-automation-ise-addon/issues/1

cdhunt commented 5 years ago

@ComDat Try pulling from the Gallery.

https://www.powershellgallery.com/packages/AudioDeviceCmdlets/3.0.0.4

Install-Module -Name AudioDeviceCmdlets
ComDat commented 5 years ago

It seems I resolved the issue. Also seems I caused it.

This Cmdlet is 32bit, I installed it in the SysWOW64 initially, since that is where I am used to installing dlls. This is what caused the error in the first place. When I went to delete the file from there, I got an error that it was already open in powershell. Duh, when referencing AudioDeviceCmdlets.dll, it was referencing this one, instead of the one in the documents folder. Once I closed, deleted AudioDeviceCmdlets.dll from SysWOW64 and reran the script it worked just fine. Sorry to bother.