Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Server 2008 R2 Powershell version 4 cannot use Get-Net* (anything) commands

$
0
0

Brand new to PS here.

I have a new install of 2008R2 and have updated to Powershell 4 by installing Windows Management Framework 4.0. The system has DotNET 4.5.1 on it as well.

I am trying to run a script for setting IP which is part of the example shown in the following blog:

http://blogs.technet.com/b/heyscriptingguy/archive/2013/01/03/use-powershell-to-deploy-a-new-active-directory-forest.aspx

So far I have run into a brick wall as I am unable to break the code for using the Get-NetAdapter command.

In the example, the following is shown:  $ipif = (Get-NetAdapter).ifIndex  New-NetIPAddress -IPAddress $ipaddress -PrefixLength $ipprefix -InterfaceIndex $ipif -DefaultGateway $ipgw

When running the script, PS errors with"Get-NetAdapter : The term 'Get-NetAdapter' is not recognized as the name of a cmdlet, function, script file, or operable program"

I found that by using "$ipif = Get-Command -Module NetAdapter -InterfaceIndex" , I get nothing. When I use the PowerShell ISE, no error is given either and the Intellisense feature is no help.

I have executedGet-Module on my system and this is the output:

ModuleType Version    Name                                          ExportedCommands                                        

---------- -------    ----                                ----------------                                        

Script     1.0.0.0    ISE                                                   {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}     

Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear...

Manifest   3.0.0.0    Microsoft.PowerShell.Security              {ConvertFrom-SecureString, ConvertTo-SecureString, Get...

Manifest   3.1.0.0    Microsoft.PowerShell.Utility                {Add-Member, Add-Type, Clear-Variable, Compare-Object...}

Manifest   3.0.0.0    Microsoft.WSMan.Management             {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan...

Executing the command$psversiontable returns the following:

Name                           Value
----                           -----

PSVersion                      4.0

WSManStackVersion       3.0

SerializationVersion        1.1.0.1

CLRVersion                    4.0.30319.18408

BuildVersion                   6.3.9600.16406

PSCompatibleVersions    {1.0, 2.0, 3.0, 4.0}

PSRemotingProtocolVersion      2.2

I would welcome suggestions, comments and/or pointers for the correct direction in which to travel.

Thanks in advance


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>