computernoob
Goto Top

Computer kann Netzwerkkarte ausschalten, um Energie zu sparen - Global deativieren

Hallo zusammen,

besteht die Möglichkeit, via GPO oder sonst wie, alle Computernetzwerkkarten in der Firma auf Dauerbetrieb zu stellen?

Ich hoffe mir kann jemand helfen

Könnte dies so klappen?

'************************************************************************  
'* VBS Script to:  
'* Enable/Disable showing the icon in your system tray for connected NICs  
'* Enable/Disable Power Management for Connected NICs  
'************************************************************************  

'Let's setup our variables  
Const HKLM = &H80000002		'HKEY_LOCAL_MACHINE info for registry writes  
Dim objReg			'Registry Object  
Dim objWMIService		'WMI Service Object  
Dim arrayNetCards		'Array of all connected NICs  
Dim objNetCard			'A specific NIC  
Dim strNICguid			'  
Dim strShowNicKeyName		'Key Specific to the Network Adapters in CurrentControlSet  
Dim strPnPCapabilitesKeyName	'Key Specific to the Network Adapters in CurrentControlSet  
Dim strPnPCapabilitesKeyName001	'Key Specific to the Network Adapters in CurrentControlSet001  
Dim strComputer			'Name of computer to modify  


strComputer = "." 		'Period = local computer  

strShowNicKeyName = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\"  
strPnPCapabilitiesKeyName = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\"  

ShowNicdwValue = 1 		'1 for ON, 0 for OFF  

PnPdwValue = 56			'56 to disable "Allow the computer to turn off this device to save power."  

				'48 to enable "Allow the computer to turn off this device to save power."  

				'32 to enable "Allow the computer to turn off this device to save power."  
				'  and enable "Allow this device to bring the computer out of standby."  

				'288 to enable "Allow the computer to turn off this device to save power."  
				'  and enable "Allow this device to bring the computer out of standby."  
				'  and enable "Only allow management stations to bring the computer out of standby."  


On Error Resume Next
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")  
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")  

'Look for the NICs that have IP enabled  
Set arrayNetCards = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")  

'Make changes on the NICs that have IP enabled  
For Each objNetCard in arrayNetCards 
	strDeviceID = Mid(objNetCard.Caption,6,4)	'Get the DeviceID of the NIC  

	'Change the "Show icon in notification area when connected value"  
	objReg.SetDWORDValue HKLM, strShowNicKeyName & "\Connection", "ShowIcon", ShowNicdwValue  
	objReg.SetDWORDValue HKLM, strShowNicKeyName001 & "\Connection", "ShowIcon", ShowNicdwValue  

	'Change the Power Management Values  
	objReg.SetDWORDValue HKLM, strPnPCapabilitiesKeyName & strDeviceID & "\","PnPCapabilities",PnPdwValue  
	objReg.SetDWORDValue HKLM, strPnPCapabilitiesKeyName001 & strDeviceID & "\","PnPCapabilities",PnPdwValue  
Next

Set objReg = Nothing
Set objWMIService = Nothing

Content-Key: 218761

Url: https://administrator.de/contentid/218761

Ausgedruckt am: 28.03.2024 um 23:03 Uhr

Mitglied: emeriks
emeriks 08.10.2013 um 15:42:32 Uhr
Goto Top
Hi,
ist die Frage jetzt, ob das per GPO geht oder ob das so mit dem Script geht?

Gesetzt den Fall, dass das Script funktioniert, kannst Du es einfach als Startup-Script in eine GPO packen, welche Du dann auf die betreffenden Computer anwendest. Beim nächsten Booten führt das der Computer dann aus. Wenn das für alle Computer gelten soll, auch für zukünftige, dann musst Du die GPO entsprechend platzieren.

Spontan:
Mir fällt auf dass "strShowNicKeyName" und "strPnPCapabilitiesKeyName" die gleiche Werte haben. Ebenso die 001-Pendants.
Weiterhin sind meines Wissens "CurrentControlSet" und "ControlSet001" deckungsgleich, es reicht also, nur einen zu schreiben. ("CurrentControlSet001" ist sowieso falsch, gibt es nicht).
"strNICguid" wird nutzlos ausgelesen, weil nicht weiterverwendet.

E.
Mitglied: Computernoob
Computernoob 08.10.2013 aktualisiert um 15:46:11 Uhr
Goto Top
Hallo,

ich würde es wenn es läuft gerne via GPO verteilen, aber dies versuch ich später, danke schon mal für die Info.

Das Script läuft noch nicht einmal, wenn ich es es via doppelklick ausführe, bekomm ich diese Fehlermeldungen im Log
Mitglied: emeriks
emeriks 08.10.2013 um 16:00:26 Uhr
Goto Top
Das Script läuft noch nicht einmal, wenn ich es es via doppelklick ausführe, bekomm ich diese Fehlermeldungen im Log

Aha. Und welche Meldungen sind das so?

E.
Mitglied: Computernoob
Computernoob 08.10.2013, aktualisiert am 09.10.2013 um 08:16:32 Uhr
Goto Top
Sorry, hab meine 2 Beiträge vertauscht face-smile

Ich hab das script oben mal neu eingefügt.
Ob das script läuft weiß ich noch nicht.