# Import-Module: This script contains malicious content and has been blocked by your antivirus software.

I’ve been working today on a little project when suddenly my modules stopped working. It was weird because I have not touched anything that could cause it. A message was a bit cryptic mentioning that my PSWriteColor module is required but not available. I’ve decided to try and load PSWriteColor manually using Import-Module command.

blog

12 Dec 2018 pl

![Import-Module: This script contains malicious content and has been blocked by your antivirus software.](/wp-content/uploads/2018/12/img_5c110627140c2.png)

[Zobacz obrazy (5)](#pf-content-image-1-0)

I've been working today on a little project when suddenly my modules stopped working. It was weird because I have not touched anything that could cause it.

> Import-Module : The script ‘PSSharedGoods.psm1' cannot be run because the following modules that are specified by the “#requires” statements of the script are missing: PSWriteColor. At C:\Support\GitHub\PSWinReporting\Examples\RunMe-SearchEvents.ps1:2 char:1
> 
> - Import-Module PSWinReporting -Force
> - CategoryInfo : ResourceUnavailable: (PSSharedGoods.psm1:String) [Import-Module], ScriptRequiresException
> - FullyQualifiedErrorId : ScriptRequiresMissingModules,Microsoft.PowerShell.Commands.ImportModuleCommand

A message was a bit cryptic mentioning that my **PSWriteColor** module is required but not available. I've decided to try and load **PSWriteColor** manually using Import-Module command.

```powershell
Import-Module PSWriteColor
```

That's where I got this little message at the bottom that made me wonder what I've done with my precious module that it is now a virus.

> Import-Module : The module manifest ‘C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PSWriteColor\PSWriteColor.psd1' could not be processed because it i s not a valid Windows PowerShell restricted language file. Remove the elements that are not permitted by the restricted language: At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\PSWriteColor\PSWriteColor.psd1:1 char:1
> 
> - ~ This script contains malicious content and has been blocked by your antivirus software. At line:1 char:1
> - Import-Module PSWriteColor
> - CategoryInfo : ResourceUnavailable: (C:\WINDOWS\syst…WriteColor.psd1:String) [Import-Module], MissingMemberException
> - FullyQualifiedErrorId : Modules_InvalidManifest,Microsoft.PowerShell.Commands.ImportModuleCommand

[!\[Blad Import-Module informujacy, ze skrypt zostal zablokowany jako zlosliwa zawartosc przez antywirusa\](/wp-content/uploads/2018/12/img_5c110627140c2.png)](/wp-content/uploads/2018/12/img_5c110627140c2.png)

### 💡 How do I fix it?

As I don't use any antivirus software other than the built-in Windows Defender I assumed that it must have updated its definitions at some point today and none of my **PowerShell** modules will be working correctly. A quick check into definitions, confirms that the update has kicked in around 11:14 but a day before and I've already worked with that module during that time.

[!\[Ekran definicji Windows Defender pokazujacy zainstalowana wersje sygnatur\](/wp-content/uploads/2018/12/img_5c11045466525.png)](/wp-content/uploads/2018/12/img_5c11045466525.png)

If we check what Windows Defender has been doing behind scenes we will find out that **AMSI (Anti-Malware Scan Interface) **was responsible for making my module rogue.

[!\[Historia ochrony Windows Defender pokazujaca AMSI blokujace modul PowerShell\](/wp-content/uploads/2018/12/img_5c14e8e2957a5.png)](/wp-content/uploads/2018/12/img_5c14e8e2957a5.png)

I've decided that updating virus definitions again should solve this, eventually I was prepared to totally disable **Windows Defender** for the time being.

[!\[Przycisk Windows Defender uzyty do pobrania nowych definicji wirusow\](/wp-content/uploads/2018/12/img_5c1104926ad5f.png)](/wp-content/uploads/2018/12/img_5c1104926ad5f.png)

Fortunately, new virus definition kicked in after few seconds everything is now working correctly. Must have been some weird hiccup on Windows Defender part. It didn't require restart of PowerShell session either.

[!\[Sesja PowerShell dzialajaca ponownie po aktualizacji definicji Defendera\](/wp-content/uploads/2018/12/img_5c110647df188.png)](/wp-content/uploads/2018/12/img_5c110647df188.png)

## Powiązane projekty

Projekty powiązane z tagami, kategoriami i treścią tego wpisu.

[Wszystkie projekty](/projekty/)

Trwa dopasowywanie projektów...

[Powrót do bloga](/blog/)

## Powiązane wpisy

- [Check an API write after a PowerShell timeout](/blog/verify-uncertain-api-outcomes-powershell/)
- [Inspect and convert mixed Office archives with PSWriteOffice](/blog/inspect-and-convert-mixed-office-archives-pswriteoffice/)
- [Compose PDF reports and automate page workflows with PSWriteOffice](/blog/automate-pdf-reports-and-page-workflows-pswriteoffice/)

<!-- PowerForge markdown artifact sha256:3B48F4B8E347FD4E0A1AC616A942F552A5435144E18669B61072DC40A3A647C8 -->
