用PYTHON修改电脑IP地址
作者:互联网
import wmi # Obtain network adaptors configurations nic_configs = wmi.WMI().Win32_NetworkAdapterConfiguration(IPEnabled=True) # First network adaptor nic = nic_configs[0] # IP address, subnetmask and gateway values should be unicode objects ip = u'192.168.0.11' subnetmask = u'255.255.255.0' gateway = u'192.168.0.1' # Set IP address, subnetmask and default gateway # Note: EnableStatic() and SetGateways() methods require *lists* of values to be passed nic.EnableStatic(IPAddress=[ip],SubnetMask=[subnetmask]) nic.SetGateways(DefaultIPGateway=[gateway])
标签:ip,network,PYTHON,nic,电脑,192.168,IP地址,subnetmask,gateway 来源: https://www.cnblogs.com/xupanfeng/p/11537484.html