8

So here's the list of available modules in this directory. As you can see DnsShell is there.

PS C:\windows\system32> Get-Module -ListAvailable

Directory: C:\windows\system32\WindowsPowerShell\v1.0\Modules

ModuleType Name                                ExportedCommands                                                             
---------- ----                                ----------------                                                             
Manifest   ActiveDirectory                     {Get-ADRootDSE, New-ADObject, Rename-       ADObject, Move-ADObject...}             
Manifest   AppLocker                           {Set-AppLockerPolicy, Get-AppLockerPolicy, Test-AppLockerPolicy, Get-AppLo...
Manifest   BitsTransfer                        {Add-BitsFile, Remove-BitsTransfer, Complete-BitsTransfer, Get-BitsTransfe...
Manifest   CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession...}
Binary     DnsShell                                                                                                         
Script     ISE                                 {New-IseSnippet, Import-IseSnippet, Get-    IseSnippet}                           
Manifest   Microsoft.PowerShell.Diagnostics    {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...}               
Manifest   Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}                                          
Manifest   Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-  ItemProperty, Join-Path...}               
Manifest   Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}                    
Manifest   Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}                   
Manifest   Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable- WSManCredSSP,   Get-WSManCredSSP, Set-WSManQui...
Script     PSDiagnostics                       {Disable-PSTrace, Disable-   PSWSManCombinedTrace, Disable-WSManTrace, Enable...
Binary     PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...}       
Manifest   PSWorkflow                          {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}                 
Manifest   PSWorkflowUtility                   Invoke-AsWorkflow                                                            
Manifest   TroubleshootingPack                 {Get-TroubleshootingPack, Invoke-TroubleshootingPack}

When I run the command to Import-Module DnsShell, I get this error and I dont know why..

PS C:\windows\system32> Import-Module DnsShell
Import-Module : Could not load file or assembly 
'file:///C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsShell\DnsShell.dll' or    one of its dependencies. Operation is 
not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1
+ Import-Module DnsShell
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Import-Module], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

Note: I would have posted pictures but I needed a rep of at least 10 in serverfault

7
  • Did you extract the whole DnsShell package to the Modules folder, or just the .dll?
    – squillman
    Jun 5, 2014 at 15:25
  • @squillman All of it.
    – runcmd
    Jun 5, 2014 at 15:26
  • Did you try to delete it and recopy? Maybe the extract got corrupted.
    – squillman
    Jun 5, 2014 at 15:32
  • @squillman Yes, still no luck. Everything is there.
    – runcmd
    Jun 5, 2014 at 15:39
  • Ok. Maybe it's blocked. Look at the file properties on DnsShell.dll and see if, on the general tab, you see an Unblock button at the bottom.
    – squillman
    Jun 5, 2014 at 15:43

5 Answers 5

7

Look at the file properties on DnsShell.dll and see if, on the general tab, you see an Unblock button at the bottom. This can happen if you download the files from a remote source.

2
  • Files extracted from a .ZIP containing an Alternate Data Streams will all contain the additional streams as well.
    – jscott
    Jun 5, 2014 at 16:16
  • In addition to this, I was also getting a DnsShell.Format.ps1xml : File skipped because of the following validation exception: DnsShell.Format.ps1.xml cannot be loaded, which was solved by doing the above (unblocking) the DnsShell.Format.ps1xml file
    – Bassie
    Apr 21, 2016 at 9:58
1

This is due to the version of PowerShell you are running. This module runs with 2.0 ONLY. If you are getting the error run 2.0 by running "powershell.exe -version 2.0" Then import the module.

0

Download module from: http://dnsshell.codeplex.com/

1- Extract DnsShell.zip to one of the paths shown by $Env:PSModulePath

2- Run: Import-Module DnsShell

1
  • Thanks for the answer, but the question is rather pointedly regarding an error with that exact procedure. If you have information on how to overcome the problem, please add it to your answer. Jun 17, 2014 at 11:51
0

For me only works doing this:

  • extract to another folder;
  • unblock all files;
  • copy the dnsshell folder to modules folder;
  • import the module;
0

If unblocking with the Explorer doesn't work or if you have many files to unblock, you can remove alternate data streams with the streams.exe Windows Sysinternals tool located at https://technet.microsoft.com/fr-fr/sysinternals/streams.aspx.

streams -s -d DNSSHELL_DIRECTORY

This command will remove every alternate data stream in the DNSSHELL_DIRECTORY files and all of its subdirectories. So don't use it on random parts of the filesystem.

To be sure, you can first list the streams with:

streams -s DNSSHELL_DIRECTORY

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .