+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, Powershell script to set Static address in Coding and Web Development; Hello, Been haveing some troubles with the script below i was wondering if anyone had any ideas? When it runs ...
  1. #1
    Matyb2k's Avatar
    Join Date
    Mar 2009
    Location
    Norfolk
    Posts
    8
    Thank Post
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Powershell script to set Static address

    Hello,

    Been haveing some troubles with the script below i was wondering if anyone had any ideas?
    When it runs it completes with an error 66, the gatway and dns change to the entered one but not the IP or subnet

    $IP = Read-Host "Enter IP address (10.10.10.2)"
    $MASK = Read-Host "Enter Subnet address (255.255.255.0)"
    $GATEWAY = Read-Host "Enter Gateway address (10.10.10.254)"
    $DNS = Read-Host "Enter DNS address (10.10.10.2)"

    $wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'"

    $wmi.EnableStatic($IP, $MASK)
    $wmi.SetGateways($GATEWAY)
    $wmi.SetDNSServerSearchOrder($DNS)

  2. #2

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,723
    Thank Post
    3,248
    Thanked 1,049 Times in 971 Posts
    Rep Power
    364
    not sure if this will help

    PowerShell Code Repository - Set-IPAddress

SHARE:
+ Post New Thread

Similar Threads

  1. LDAP script to block exchange address lists
    By jdibsdale in forum Windows
    Replies: 3
    Last Post: 10th September 2010, 02:20 PM
  2. Powershell script to list printers with WPK
    By fawkers in forum Scripts
    Replies: 1
    Last Post: 17th November 2009, 09:55 AM
  3. Replies: 0
    Last Post: 22nd February 2008, 11:26 AM
  4. Replies: 0
    Last Post: 24th January 2008, 02:58 PM
  5. Script to set active directory object security
    By meastaugh1 in forum Windows
    Replies: 4
    Last Post: 5th January 2007, 04:28 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •