Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure static IP address with vbs

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to configure static IP address with vbs". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to configure static IP address with vbs".

Set the IP address of the computer to 192.168.1.141 and the IP gateway to 192.168.1.100.

Script code

The copy code is as follows:

StrComputer = "." Set objWMIService = GetObject ("winmgmts:\\" & 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 If Next thank you for reading, the above is "how to use vbs to configure static IP address" content, after the study of this article, I believe you on how to use vbs to configure static IP address this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report