1 Reply Latest reply: Jan 19, 2012 3:22 PM by Guest RSS

Notify.vbs + SCCM + Remote Database doesn't work

ricdanger Community Member
Currently Being Moderated

Hi,

 

I'm trying to get the new host based configuration to work with SCCM, but the provided notify.vbs script doesn't seem to work when the site database is not hosted on the configuration manager server. As far as I can see, Notify.vbs blindly adds the sccmSiteServer address as the SQL server:

 

'Invoke string with arugments for SiteCode,SQLServer Name,
'Resource Name (FQDN of AMT machine),
'ResourceID returned from ImportComputers
'This code uses the translator to work around and SCCM AMT import bug

strInput="<p:ImportComputer_INPUT xmlns:p=""ImportWizard"">" &_
          "<p:Site>" & "SMS_" & sitecode & "</p:Site>" &_
          "<p:Server>" & sccmSiteServer & "</p:Server>" &_
          "<p:Name>" & fqdn & "</p:Name>" &_
          "<p:ResourceId>" & ResourceID & "</p:ResourceId>" &_
          "</p:ImportComputer_INPUT>"

 

But changing it to my real database server does not seem to work, because wsman translator tries to connect using named pipes (should try TCP for remote database). I had a look at the wstrans source but didn't find any reference to SQL.

 

Any idea how to fix this?

 

Thanks.

  • 1. Re: Notify.vbs + SCCM + Remote Database doesn't work
    Currently Being Moderated

    Below is how the translator establishes a database connection.

    It basically builds a SQL connection string based on the information passed in by the notify.vbs and builds a connection string based on that information.  The currently logged on credentials are use (Translator by default runs as the local system account just like SMS exec).  

    [Intel vPro Expert Center Moderator added: Any user submitted code or materials posted on this blog is supplied under license from the submitter, and should be used or downloaded in accordance with any license terms specified. Intel is not responsible for user submitted code nor warrants that it will work correctly.  If no license is provided, you should contact the submitter. Notify.vbs is provided by Intel under the license included with the Intel Setup and Configuration Service (Intel SCS) download package.]

    Hope this helps identify how to connect to your database.

    using System.Data.SqlClient;

     

     

     

    SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();

    CimItem inputItem = context.GetItem();

     

    string fqdName = (string)inputItem.GetProperty("Name");

     

    string siteCode = (string)inputItem.GetProperty("Site");

     

    string serverName = (string)inputItem.GetProperty("Server");

     

    string resId = (string)inputItem.GetProperty("ResourceId");

      

    builder.UserID="default";

    builder.Password"default";

    builder.ConnectTimeout = 30;

    builder.Add"server", serverName);

    builder.Add("database", siteCode);

    builder.Add("Trusted_Connection", "yes");

     

    CimContext.TraceInformati("Conneting to " + serverName);

    SqlConnection connection= new SqlConnection(builder.ToString());

     

     

     

    Hope this helps identify how to connect to your database.

     

     

     

More Like This

  • Retrieving data ...