Import-Module does nothing

Tagged: 

This topic contains 3 replies, has 3 voices, and was last updated by  rambog cnonline.net 3 years, 5 months ago.

  • Author
    Posts
  • #14818

    rambog cnonline.net
    Participant

    On my Windows 8.1 machine, I tried to use the get-adcomputer command but got the cmdlet unknown error. I then tried to "Import-Module ActiveDirectory" but also got nowhere. How do I correct this and how do I allow auto loading of modules when they are called? (I thought that was the default setting after version 3.0)

    Below are some pertinent details:

    $psversiontable

    Name Value
    —- —–
    PSVersion 4.0
    WSManStackVersion 3.0
    SerializationVersion 1.1.0.1
    CLRVersion 4.0.30319.34014
    BuildVersion 6.3.9600.16394
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
    PSRemotingProtocolVersion 2.2

    PS C:\Users\rambo_000> import-module ActiveDirectory
    import-module : The specified module 'ActiveDirectory' was not loaded because no valid module file was found in any
    module directory.
    At line:1 char:1
    + import-module ActiveDirectory
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ResourceUnavailable: (ActiveDirectory:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

    PS C:\Users\rambo_000> $PSModuleAutoLoadingPreference
    PS C:\Users\rambo_000>

    (end of shell capture...the last command $PSModuleAutoLoadingPreference does not come back with anything)

  • #14819

    Dave Wyatt
    Moderator

    The ActiveDirectory module is not part of the base PowerShell installation; it's part of the Remote Server Administration Tools (RSAT) package, which you can download from http://www.microsoft.com/en-ca/download/details.aspx?id=39296 .

  • #14830

    Vern Anderson
    Participant

    Or make sure you're on the domain controller logged in as an Administrator and the PowerShell console is also elevated as Administrator.

  • #14835

    rambog cnonline.net
    Participant

    I was in as local administrator. Unfortunately, the edition of Windows 8.1 is not Pro or Enterprise so RSAT will not work 🙁

    p.s. I was simply trying out the effects of get-adcomputer on my local machine to see what the results would be for osversion. When I run [environment]::OSVersion.Version from the powershell window and from the ISE, I get different results. The ISE seems to report it incorrectly and wanted to see what get-adcomputer will yield. I'll have to wait until work upgrades our machines to 8.1.

    Thanks for your help.

You must be logged in to reply to this topic.