Menu
CCMEXEC.COM – Enterprise Mobility
  • Home
  • General
  • Configuration Manager
  • Windows 10
  • Intune
  • GitHub
  • Windows 11
  • About the author
CCMEXEC.COM – Enterprise Mobility

Installing the SCCM client using vbscript

Posted on November 18, 2011November 22, 2011 by Jörgen Nilsson

In some scenarios you need to install the SCCM client using another Software Distribution tool than Configuration Manager, yes I know it sounds strange 😉

If you have tried this you know that the Ccmsetup.exe installs a service and the exits in the user context so that control is returned to the vbscript, cmd file or whatever method you use to run Ccmsetup.

There are two ways of solving this:

1. Run Ccmsetup.exe with the /noservice switch then ccmsetup runs the setup in the user with which you triggered the installation and not using  a service in System context.

2.Use vbscript that checks for an active process called “ccmsetup.exe” and wait for it to exit.

I thought of writing a script for this and then I found this excellent discussion on a forum: http://www.tek-tips.com/viewthread.cfm?qid=911251

That script will work for Ccmsetup as well. Below is the modified script for ccmsetup.exe


Set WshShell = Nothing
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "ccmsetup.exe SMSSITECODE=020 FSP=SCCM01", 0, True
Wscript.Sleep 5000
set svc=getobject("winmgmts:root\cimv2")
sQuery="select * from win32_process where name='ccmsetup.exe'"
set cproc=svc.execquery(sQuery)
iniproc=cproc.count
Do While iniproc = 1
wscript.sleep 5000
set svc=getobject("winmgmts:root\cimv2")
sQuery="select * from win32_process where name='ccmsetup.exe'"
set cproc=svc.execquery(sQuery)
iniproc=cproc.count
Loop
set cproc=nothing
set svc=nothing
Set WshShell = Nothing

6 thoughts on “Installing the SCCM client using vbscript”

  1. Bernd says:
    November 22, 2011 at 4:20 pm

    You forgot to delete the “objShell.Run” in line 3 of the script.

    Reply
  2. Jörgen Nilsson says:
    November 22, 2011 at 5:03 pm

    thanks for the heads-up :$
    /jörgen

    Reply
  3. Binkan says:
    November 28, 2011 at 4:32 pm

    Please, post the full, corrected, script.

    Reply
  4. Jörgen Nilsson says:
    November 28, 2011 at 10:14 pm

    Hi,
    I have updated about a week ago.
    ccmsetup.exe must be in the same directory as the script and run with cscript.

    /jörgen

    Reply
  5. Em says:
    February 7, 2012 at 9:25 am

    How do i fix the script to specify the side code as a variable instead of hard coding the variable or other switches as a variable.

    Reply
  6. Carlos says:
    December 17, 2013 at 5:51 pm

    Could you provide script for uninstalling SCCM 2007 client. Thanks!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

My name is Jörgen Nilsson and I work as a Senior Consultant at Onevinn in Malmö, Sweden. This is my blog where I will share tips and stuff for my own and everyone elses use on Enterprise Mobility and Windows related topics.
All code is provided "AS-IS" with no warranties.

Tweets by ccmexec

Recent Posts

  • Windows Servicing, Personal Teams and Success.cmd
  • Windows MDM Security Baseline – Settings Catalog
  • Configuring MS Edge Security Baseline v107 using Settings Catalog
  • Configuring Desktop App Installer using CSP and script?!
  • Customizing Taskbar and Start in Windows 11 22h2 with PowerShell

©2023 CCMEXEC.COM – Enterprise Mobility | WordPress Theme by Superb Themes
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT