Sometimes the easiest way to install the client may be running it with psexec. That’s especially true if the machine hasn’t been discovered by some mechanism. The options for doing this often cause confusion, because there are two files involved – ccmsetup.exe and client.msi. CCMSETUP looks for client.msi in whatever folder ccmsetup is run from. If you use the -c switch that’s normal with psexec, to copy the file being executed, it only copies the exe. That then hangs when it can’t locate the msi, and the ccmsetup.log file is filled with messages reporting that it can’t find client.msi in C:\Windows\System32 and will retry in 20 minutes.
The solution is to run ccmsetup from a location containing both files. The easiest is usually on an SMS site server. The proper command line is:
psexec -s \\computer \\SMSserver\client\i386\ccmsetup.exe [ccmsetup switches]
The -s command says to run using the system account. Do not use -c, as that will cause the errors described above. Using -d is optional; ccmsetup terminates pretty quickly. I generally leave it off so I can see the zero return code.
【个人引申】个人觉得 psexec 的最大一个用处是,可以写一个在远程机器上执行的批处理或者其他脚本,然后用 psexec –c 参数将这个脚本拷贝到远程机器上执行。例如本文中的例子可以这样写:
需要拷贝到远程机器的批处理文件,假设名称为 ClientInstall.bat,内容为:
\\SMSserver\client\i386\ccmsetup.exe [ccmsetup switches]
然后可以在机器上执行:
Psexec \\computer –c ClientInstall.bat
这样就达到了相同的目的。之后如需修改参数,只需要修改 ClientInstall.bat 中的参数即可。