Using VBS and CCTK.exe for BIOS changes, how to include parameters
Hi,
We have a company with a few hundred pc's
We would like to change the asset tag of our excisting pc's and we think cctk can be a great for that.
I'm not that great at scripting so i really would appreciate a experts look at my problem.. ;-)
I have two questions
1. Is there someone who could tell me how to (correctly) include the parameter (--asset) in the script ?
2. My current script gives me this error: Line 11, System cannot find file.
Code: 80070002
Source: WshShell.Exec
Script:
1 Option Explicit
2
3 const COMMAND_EXEC = "C:\Asset\cctk.exe"
4
5 dim objExec, objWshShell, objStdOut
6 dim strComputerName, strResult
7
8 set objWshShell = CreateObject("WSCript.Shell")
9 strComputerName = objWshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
10
11 set objExec = objWshShell.Exec (COMMAND_EXEC & "--asset=" & strComputerName)
12 set objStdOut = objExec.StdOut
13
14 strResult = objStdOut.ReadAll
15 WScript.Echo strResult
16
17 set objExec = nothing
18 set objWshShell = nothing
19 set objStdOut = nothing
We have a company with a few hundred pc's
We would like to change the asset tag of our excisting pc's and we think cctk can be a great for that.
I'm not that great at scripting so i really would appreciate a experts look at my problem.. ;-)
I have two questions
1. Is there someone who could tell me how to (correctly) include the parameter (--asset) in the script ?
2. My current script gives me this error: Line 11, System cannot find file.
Code: 80070002
Source: WshShell.Exec
Script:
1 Option Explicit
2
3 const COMMAND_EXEC = "C:\Asset\cctk.exe"
4
5 dim objExec, objWshShell, objStdOut
6 dim strComputerName, strResult
7
8 set objWshShell = CreateObject("WSCript.Shell")
9 strComputerName = objWshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
10
11 set objExec = objWshShell.Exec (COMMAND_EXEC & "--asset=" & strComputerName)
12 set objStdOut = objExec.StdOut
13
14 strResult = objStdOut.ReadAll
15 WScript.Echo strResult
16
17 set objExec = nothing
18 set objWshShell = nothing
19 set objStdOut = nothing
0 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Just giving this a quick look try adding a space in front of the --asset. From this: 11 set objExec = objWshShell.Exec (COMMAND_EXEC & "--asset=" & strComputerName) To this: 11 set objExec = objWshShell.Exec (COMMAND_EXEC & " --asset=" & strComputerName) If not the command line when expanded becomes: C:\Asset\cctk.exe--asset=hostname
Just giving this a quick look try adding a space in front of the --asset. From this: 11 set objExec = objWshShell.Exec (COMMAND_EXEC & "--asset=" & strComputerName) To this: 11 set objExec = objWshShell.Exec (COMMAND_EXEC & " --asset=" & strComputerName) If not the command line when expanded becomes: C:\Asset\cctk.exe--asset=hostname
Please log in to answer
Posted by:
dchristian
12 years ago
Just giving this a quick look try adding a space in front of the --asset.
From this:
11 set objExec = objWshShell.Exec (COMMAND_EXEC & "--asset=" & strComputerName)
To this:
11 set objExec = objWshShell.Exec (COMMAND_EXEC & " --asset=" & strComputerName)
If not the command line when expanded becomes:
C:\Asset\cctk.exe--asset=hostname
From this:
11 set objExec = objWshShell.Exec (COMMAND_EXEC & "--asset=" & strComputerName)
To this:
11 set objExec = objWshShell.Exec (COMMAND_EXEC & " --asset=" & strComputerName)
If not the command line when expanded becomes:
C:\Asset\cctk.exe--asset=hostname
Comments:
-
dchristian, thank you so much for your help !!
Finally the script works fine !! - Mesjoggah 12 years ago