แหล่งรวม Script Window Scripts ต่าง ๆ

ผมเจอปัญหาเกี่ยวกับ Network ของ Notebook คือจะต้องเปลี่ยน ip address ของที่ทำงาน และ ที่บ้าน เป็นคนละ class กัน ทำให้ต้องเปลี่ยนทุกวัน เลยลองหา Script ที่จะทำการเปลีย่นให้เอง โดยเจอแหล่งรวม Srcipt ของ Windows โดยเป็นแบบ VB Scripts ลองดูนะครับ น่าจะเหมาะกับเพื่อน ๆ ที่ใช้งาน notebook กันนะครับ ..

VB Scripts | http://scriptcenter.itms.dk/

Static Network Scripts

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

DHCP Network Scripts (DHCP.vbs)

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objNetAdapter In colNetAdapters
errEnable = objNetAdapter.EnableDHCP()
If errEnable = 0 Then
Wscript.Echo "DHCP has been enabled."
Else
Wscript.Echo "DHCP could not be enabled."
End If
Next

 

Batch Scripts

ตัวอย่างรูปแบบคำสั่งด้านล่างนะครับ
-----------------------------------------------------------------------
คำสั่งเปลียน IP Subnet และ Gateway ให้เป็นแบบ Static

netsh interface ip set address "ชื่อCardLan" static "IP" "Subnet" "GW" 1

ตัวอย่าง

netsh interface ip set address Wlan static 192.168.0.22 255.255.255.0 192.168.0.2 1

เอาใส่ Notepad แล้วก็ Save เป็น .Bat
-----------------------------------------------------------------------
คำสั่งเปลียน IP Subnet และ Gateway ให้เป็นแบบ DHCP

netsh interface ip set address "ชื่อCardLan" dhcp

ตัวอย่าง

netsh interface ip set address Wlan dhcp

เอาใส่ Notepad แล้วก็ Save เป็น .Bat
-----------------------------------------------------------------------
คำสั่งเปลี่ยน DNSให้เป็นแบบ DHCP

netsh interface ip set dns "ชื่อการ์ดlan" dhcp
ตัวอย่าง

netsh interface ip set dns Wlan dhcp

เอาใส่ Notepad แล้วก็ Save เป็น .Bat

-----------------------------------------------------------------------
คำสั่งเปลี่ยน DNSให้เป็นแบบ Static

netsh interface ip set dns "ชื่อการ์ดlan" static "DNS"

ตัวอย่าง

netsh interface ip set dns Wlan static 192.168.0.2

เอาใส่ Notepad แล้วก็ Save เป็น .Bat

 

เว็บไซต์อื่น ๆ

ข่าวย้อนหลังที่เกี่ยวข้อง

ฝากความคิดเห็นของคุณ (Comments)


   บล็อกอินเทรนด์ !! คุณชอบเขียน และ เราชอบอ่าน เราขอเป็นสื่อกลางให้เพื่อน ๆ ส่งข่าวสารหรือบทความ ที่น่าสนใจ หรือ อินเทรนด์มาให้ได้อ่านกัน ถ้าเพื่อน ๆ ต้องการคุยกับเรา สามารถพูดคุยกันได้ที่ Twitter , Email หรือ .. ผ่านแบบฟอร์มติดต่อสอบถามได้นะครับ แล้วทางทีมงานจะปรับปรุงคุณภาพต่อ ๆ ไปครับ ..
ส่งข่าวผ่าน RSS
ผ่าน RSS
ส่งตรงข่าวสารจากเว็บไซต์คุณแบบรวดเร็วผ่าน RSS
ส่งข่าวผ่าน แบบฟอร์ม [ Post Form ]
ผ่าน แบบฟอร์ม [ Post Form ]
อัพเดทบทความผ่านแบบฟอร์มออน์ไลน์ ในหน้าเว็บไซต์ บล็อกอินเทรนด์
ส่งข่าวผ่าน Email
ผ่าน อีเมล์
ส่งตรงข่าวสารจากแบบรวดเร็วผ่าน อีเมล์ [ Email ]