You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用PowerShell对接VirusTotal API遇类型缺失,求Add-Type解决方案

Fix for "Unable to find type [System.Security.Cryptography.ProtectedData]" in VirusTotal PowerShell Scripts

Hey there! I’ve dealt with this exact error when working with VirusTotal’s official PowerShell code, so I can help you resolve it quickly.

The error pops up because the [System.Security.Cryptography.ProtectedData] class lives in the System.Security .NET assembly, which isn’t always automatically loaded in PowerShell—especially in older versions or constrained environments.

To fix this, you just need to explicitly load the assembly at the very start of your script, before any code that references ProtectedData. Add this line:

Add-Type -AssemblyName System.Security

This tells PowerShell to load the necessary assembly that contains the ProtectedData type, which the VirusTotal script uses to securely store and retrieve your API key. Once you add this line, your code should run without that type-finding error.

内容的提问来源于stack exchange,提问作者Sam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:09:15