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
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
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

3
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
Answered 03/26/2012 by: dchristian
Red Belt

  • dchristian, thank you so much for your help !!
    Finally the script works fine !!
Please log in to comment
Answer this question or Comment on this question for clarity