PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms..win.server.scripting > change the ip address to multiple computers
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
change the ip address to multiple computers

Réponse
 
LinkBack Outils de la discussion
Vieux 21/09/2007, 22h02   #1
gustavo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut change the ip address to multiple computers

Hello, I Have the following script to change the ip address to multiple
computers

strComputer = "."
strComputer1 = "computer2"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

strIPAddress = Array("192.168.1.141")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.1.100")
strGatewayMetric = Array(1)

For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End I
  Réponse avec citation
Vieux 23/09/2007, 19h02   #2
Al Dunbar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: change the ip address to multiple computers

"gustavo" <gustavo@discussions.microsoft.com> wrote in message
news:ACF29C7E-3227-486C-BAE3-9A84B074C555@microsoft.com...
> Hello, I Have the following script to change the ip address to multiple
> computers
>
> strComputer = "."
> strComputer1 = "computer2"
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
>
> Set colNetAdapters = objWMIService.ExecQuery _
> ("Select * from Win32_NetworkAdapterConfiguration where
> IPEnabled=TRUE")
>
> strIPAddress = Array("192.168.1.141")
> strSubnetMask = Array("255.255.255.0")
> strGateway = Array("192.168.1.100")
> strGatewayMetric = Array(1)
>
> For Each objNetAdapter in colNetAdapters
> errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
> errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
> If errEnable = 0 Then
> WScript.Echo "The IP address has been changed."
> Else
> WScript.Echo "The IP address could not be changed."
> End I



I assume that, in the process of truncating your script, the usenet goblins
stripped your question off the end. Please re-post.

/Al


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h20.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09385 seconds with 10 queries