I'm trying to create a script that will output a list of Fully Qualified Names for DLLs. The script I currently have works fine when it comes to outputting the data I want.
The problem is that this locks the file. So if I want to delete one of the files that I loaded in my session I get the following message:
The action can't be completed because the file is open in Windows PowerShell.
What do I change to have PowerShell release the lock on the file?
I usually run PowerShell script from the internal console in Visual Studio Code, but the problem also exists when I run it directly from PowerShell.
Enter-PSSession -ComputerName $env:computername
Get-ChildItem -Path $input -Filter '*.dll' | ForEach-Object {
$assembly = [System.Reflection.Assembly]::LoadFrom($_.FullName)
Write-Host $assembly.FullName
}
Exit-PSSession