You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install-Package: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:9711
Line |
9711 | … talledPackages = PackageManagement\Install-Package @PSBoundParameters
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Package 'PSReflect-Functions' failed to be installed because: Operation did not complete successfully
| because the file contains a virus or potentially unwanted software. :
| 'C:\Users\Scott\AppData\Local\Temp\e5unvpcv\PSReflect.ps1'
Windows Defender also flags "HackTool:PowerShell/PowerView" on the same file.
The text was updated successfully, but these errors were encountered:
Unfortunately the module is built on PSReflect which is not inherently malicious, but has been used with a lot of PowerShell based hacking tools. This is a situation where PSReflect is more likely to be used for nefarious purposes than legitimate purposes (like PSReflect-Functions) and as a result Defender errors on the side of caution and labels it as a virus. My recommendation depends on your use case.
If you are just interested in playing around with this in a test lab, then you can simply disable defender to solve the problem. You may have to redownload the module because defender sometimes quarantines a couple files.
If you plan to use this in production, then it is possible to create an exception for the file in defender. Just be aware that any time you create an exception you are creating a potential blind spot. So I recommend potentially monitoring that location via a different non-preventative solution.
If you aren't comfortable with the exception, it is possible to achieve similar results without reflection using a technique called Platform/Invoke (P/Invoke). This method is used frequently in the C# source code and serves as a base for the capabilities of many .NET classes. If you are using P/Invoke from PowerShell, you will be compiling code as part of your script which can leave compilation artifacts in the form of files on the file system. These artifacts aren't ideal in forensic or red teaming scenarios and avoiding them was the original use case for PSReflect.
I hope this helps. Please let me know if you are interested in further clarification.
I get the following when trying to install:
Windows Defender also flags "HackTool:PowerShell/PowerView" on the same file.
The text was updated successfully, but these errors were encountered: