Bonjour,
J'ai trouvé ça sur internet en faisant plusieurs recherches :
Le problème est qu'il me renvoi cette erreur : "incorrect syntax. You should run: cscript.exe /nologo SampleWakeOnLAN.vbs <systemname>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103 '********************************************************************** '*** Name: SampleWakeOnLAN.vbs '*** Purpose: To Enable the Wake On LAN on a Dell OMCI client. '*** Usage: cscript.exe //nologo SampleWakeOnLAN.vbs <systemname> '*** '*** This sample script is provided as an example only, and has not been '*** tested, nor is warranted in any way by Dell; Dell disclaims any '*** liability in connection therewith. Dell provides no technical '*** support with regard to such scripting. For more information on WMI '*** scripting, refer to applicable Microsoft documentation. '*** '*** NOTE: Replace <Password> in line 73 (inside the quotes) '*** with the correct password if there is any password set in the system. '*** If both passwords(Admin and Boot) are set please replace it with Admin Password. '*** If there is no password set in the system please leave it as empty. '********************************************************************** Option Explicit '*** Declare variables Dim strNameSpace Dim strComputerName Dim strClassName Dim strKeyValue Dim objWMIService Dim ColSystem Dim objInstance Dim oInParams Dim returnValue Dim strAttributeName(2) Dim strAttributeValue(2) Dim strAuthorizationToken '*** Check that the right executable was used to run the script '*** and that all parameters were passed If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _ (Wscript.Arguments.Count < 1) Then Call Usage() WScript.Quit End If '*** Initialize variables strNameSpace = "root\dcim\sysman" strComputerName = WScript.Arguments(0) strClassName = "DCIM_BIOSEnumeration" strKeyValue = "Root/MainSystemChassis/BIOSSetupParent/BiosSetupWOL" '*** Retrieve the instance of DCIM_BIOSEnumeration class for the TPM Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate," &_ "AuthenticationLevel=pktprivacy}\\" & strComputerName & "\" &_ strNameSpace & ":" & strClassName & "=" & Chr(34) & strKeyValue & Chr(34)) WScript.Echo objInstance.CurrentValue(0) WScript.Echo objInstance.AttributeName '*** All possible values for WOL are as follows: '*** 1 = Disable '*** 2 = Add-in '*** 3 = On board '*** 4 = LAN '*** 5 = PXE boot enable '*** 6 = LAN or WLAN '*** 7 = WLAN only If objInstance.CurrentValue(0) = 1 Then '*** Here is where you would perform an action such as writing the computer '*** name out to a text file or enabling WoL with the following code... '*** This section will attempt to set the value to 4 (LAN) as this is the most '*** popular for recent Dell systems '*** Initialize variables ' strClassName = "DCIM_BIOSService" ' strAttributeName(0) = objInstance.AttributeName ' strAttributeValue(0) = "4" ' strAuthorizationToken = "Password" ' returnValue = 0 '*** Retrieve the instance of DCIM_BIOSService class ' Set objWMIService = GetObject("WinMgmts:{impersonationLevel=impersonate," &_ ' "AuthenticationLevel=pktprivacy}\\" & strComputerName & "\" &_ ' strNameSpace) ' Set ColSystem=objWMIService.execquery ("Select * from " & strClassName) ' For each objInstance in ColSystem ' Set oInParams = objInstance.Methods_("SetBIOSAttributes").InParameters.SpawnInstance_ ' oInParams.AttributeName = strAttributeName ' oInParams.AttributeValue = strAttributeValue ' oInParams.AuthorizationToken = strAuthorizationToken ' Set returnValue = objInstance.ExecMethod_("SetBIOSAttributes", oInParams) ' Exit For ' Next End If '*** If any errors occurred, let the user know If Err.Number <> 0 Then WScript.Echo "Enabling Wake On LAN failed." End If '*** Sub used to display the correct usage of the script Sub Usage() Dim strMessage strMessage = "incorrect syntax. You should run: " & vbCRLF & _ "cscript.exe /nologo SampleWakeOnLAN.vbs <systemname>" WScript.Echo strMessage End Sub
Vous auriez une idée ?
Merci par avance.
Partager