InstallModuleFromGit icon indicating copy to clipboard operation
InstallModuleFromGit copied to clipboard

Access Denied error on Temp Dir?

Open sparkle263 opened this issue 2 years ago • 1 comments

Hello, I found your repo after not being able to get dfinkle's one to work - though the idea is super promising!

And I can get your module installed with no problem, everything looks good. But when I go to use it as intended, I keep getting an Accessed Denied error on the temp dir it is trying to use...? PS is running as Admin, I am a Local admin of the machine, and even if I specify a destination path, it never gets that far... Am I missing something simple here?

.Net FrameWork Full Version : 4.8.04084
PowerShell Version          : 5.1.19041.2673
OS Version                  : Microsoft Windows 10 Enterprise  v. 22H2 Build. 19045.2728
--- [WITHOUT DESTINATION PATH] -----------------------------------------------------------------------------------

Remove-Item : Cannot remove item C:\Users\USERNAME\AppData\Local\Temp\01aefda8-69bf-48ec-82ea-9ca9b8193d59.tmp: 
The process cannot access the file 'C:\Users\USERNAME\AppData\Local\Temp\01aefda8-69bf-48ec-82ea-9ca9b8193d59.tmp' 
because it is being used by another process.

At C:\Program Files\WindowsPowerShell\Modules\InstallModuleFromGit\1.2.0\Public\Get-GitModule.ps1:53 char:17
+                 Remove-Item (Join-Path $tempDir '*') -Recurse -Force
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\USERNAME...ca9b8193d59.tmp:FileInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand

--- [WITH DESTINATION PATH] ---------------------------------------------------------------------------------------
WARNING: Install-GitModule using path which is not in $Env:PSModulePath (O:\Temp\TestModules)

Remove-Item : Cannot remove item C:\Users\USERNAME\AppData\Local\Temp\f86a921e-06e3-4c96-b089-54ac0ef8fa52.tmp: 
The process cannot access the file 'C:\Users\USERNAME\AppData\Local\Temp\f86a921e-06e3-4c96-b089-54ac0ef8fa52.tmp' 
because it is being used by another process.

At C:\Program Files\WindowsPowerShell\Modules\InstallModuleFromGit\1.2.0\Public\Get-GitModule.ps1:53 char:17
+                 Remove-Item (Join-Path $tempDir '*') -Recurse -Force
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\USERNAME...4ac0ef8fa52.tmp:FileInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
--------------------------------------------------------------------------------------------------------------------

sparkle263 avatar Apr 04 '23 17:04 sparkle263

Hey i just fixed this issue by removing the trailing / in the Uri i put in, might work for you too.

DaRacci avatar Mar 12 '24 02:03 DaRacci