BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jimbarbour
Meteorite | Level 14

I'm having a problem automating a SAS EG 5.1 project.  I want to run my project using the Windows scheduler.  Using SAS EG, I generated a VB script.  The generated script looks fine, but it won't connect.  

 

Here's what happens when I run the generated VB script:

A credentials window opens (see first attachment), I enter my credentials, but I consistently get a pop up (see second attachment) with error 80040417, "Unable to connect to server:  SASApp".

 

It doesn't seem to matter whether I provide the correct LogOn ID and password or not.  Either way, I get error 80040417.SASApp_Log_On.jpgSASApp_Log_On.jpg

 

I can see, from tracing the logic of the vb script, that I can successfully:

1.  Create the SASEGObjectModel.Application.5.1

2.  Open the project (app.Open)

 

But when I try to execute Project.run, I get the credentials window, and then it fails no matter what credentials I enter.

 

I'm running SAS EG 5.1 32 bit on a Windows 7 Enterprise machine.  My SAS server is a remote AIX server.  I am able to log on using Putty TelNet to the AIX server, so I know my LogOn ID and password have not expired.

 

If anyone had any ideas as to how to proceed to de-bug this problem, I would be most receptive.  I'm quite at a loss as to how I might proceed.

 

Thank you,

 

Jim


SAS_EG_Connect_Error.jpgSASApp_Log_On.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

The above post was a bit lengthy, so I'll repeat the summary here for those who just want to skip to the answer.  I do hope that those at the SAS Institute who may be reading this will take a moment to read my concluding remarks in the preceeding post.

 

SUMMARY

This is a high level summary of what I did to get a vb script to run an EG project in batch mode in an evironment with virtualized SAS EG (i.e. SAS EG isn't physically installed on the local hard drive but rather is invoked through some type of virtualization client such as Microsoft Application Virtualization Client):

1.  Generate a vb script

2.  Write a batch file that invokes the "bitness" correct version of CSscript.exe and executes the above generated vb script

3.  Download and install SASEGScripting.dll 

4.  Download and install SAS Integration Technologies client

5.  Add one's profile to ConfigurationV51.xml

6.  Download and install SAS Providers for OLE DB

7.  Bug the heck out of Chris Hemedinger (essential step in this case) Smiley Happy

 

The above changes have to be made on one's local machine, not on virtualized drives.

 

Note:  I have only tried this with Microsoft Application Virtualization Client, but I think it would work with other virtualized forms of SAS EG such as Citrix.

 

Thanks,

 

Jim

View solution in original post

11 REPLIES 11
ChrisHemedinger
Community Manager

You didn't say, but can you verify that you can run the project via EG interactively (not using the script)?  Just want to verify that you can connect to the SAS workspace on AIX session via EG at all.

 

Also, there are instructions for how to specify credentials for automation so that you can avoid the prompt: see this SAS Note about creating a credentials.xml file.

 

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
jimbarbour
Meteorite | Level 14

Hi, Chris,

 

Thank you for your reply.

 

Yes, I can execute SAS EG on my Win 7 machine.  However, I'm doing so in a "virtualized" environment.  SAS EG isn't actually installed on my machine.  When I click on the SAS EG icon, I actually execute "C:\Program Files (x86)\Microsoft Application Virtualization Client\sfttray.exe" which causes the virtualized app, SAS EG in this case, to execute on my machine. I am then able to run SAS code on our AIX server under my profile.

 

One other factoid that may be relevant:  I notice that when I execute the "review your profiles" vb script that I found on SAS Dummy (http://blogs.sas.com/content/sasdummy/2012/02/02/profiles-via-eg-automation/), that no profiles come up except the null provider even though I do in fact have a profile on our SASApp server.  I suspect that this is due to the fact that I'm operating in a virtualized environment.

Profile available: Null Provider, Host: , Port:

Tomorrow, I will try the XML credentials idea that you have suggested, but I wonder:

Is it even possible to automate SAS EG when one runs in a virtualized environment?

 

Incidentally, I couldn't even open SASEGObjectModel.Application.5.1 at first due to the virtualized nature of my environment.  It took me a bit of research and effort to figure out that I needed to put SASEGScripting.dll and RegTypeLib.exe on my hard drive and then go through the steps to register SASEGScripting.dll.  I can now run the automation script generated by SAS EG, but as indicated in my first post in this thread, it fails at the point of Project.run.

 

Thank you,

 

Jim

ChrisHemedinger
Community Manager

EG automation -- through a VB script or any script -- automates the EG application.  EG has to be installed on the same machine that you're running the script on.  I'm not sure how you're getting the results that your getting if you don't have EG installed on the same machine as the scripting engine.

 

This script is a test that can show you whether you have EG installed and registered.  Save to a VBS file, then run using CSCRIPT.exe or %windir%\SysWOW64\CSCRIPT.exe (for 32-bit EG):

 

' force declaration of variables in VB Script
Option Explicit
Dim Application
' Create a new SAS Enterprise Guide automation session
Set Application = WScript.CreateObject("SASEGObjectModel.Application.5.1")
WScript.Echo Application.Name & ", Version: " & Application.Version
Application.Quit

The output should be something like:

 

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Enterprise Guide, Version: 5.100.0.0

 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
jimbarbour
Meteorite | Level 14

Hi, Chris,

 

When I run the script you suggested, above, I receive the following output:

 

>C:\Windows\SysWOW64\cscript.exe //X EGScript_Test_Installation.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Enterprise Guide, Version: 5.100.0.0

However, as I've mentioned, I operate in a virtualized environment.  My company uses Microsoft Application Virtualization Client which causes a "Q:" drive to magically appear where there was none before, and it appears that SAS executes from there although when I'm working within EG (in typical GUI interactive mode), everything appears to be mapped to "C:".  

 

 

I don't know if this might be helpful, but when in SAS EG, if I click on Help, About, Configuration Details, the below is what I get.  I notice that it says that I do have a profile on SASApp.  In addition, when in SAS EG, I can browse folders on SASApp, open SAS libraries, etc. which further convinces me that I have a working profile (either that or magic elves have been doing all my work on SASApp for me for the past X months of 2015).  🙂 

SAS_EG_Configuration.jpg

 

Regarding KB 30917:  I see from my configuration details, above, that my SAS Shared Files reside in "C:\SAShome\x86".  Into that directory, I placed a Credentials.xml file as follows:

<xml FileVersion="5.1"> 
<credentials>
<server name="SASApp" userid="barboujb" password="{SAS002}F58A36493CF68E7202F213921D002D65"/>
</credentials>
</xml>

The above password was cut and paste from a SAS log based on a run of PWENCODE.

 

Results:  I saw no dicernable change in behavior.  In other words, a credentials window still pops up, and no matter what I enter, I get error 80040417 (Unable to connect to server:  SASApp).  If I press cancel, I get the following:

SAS_Connect_Error.jpg

 

Thank you,

 

Jim

ChrisHemedinger
Community Manager

Sounds like you're doing everything right, but something is still amiss -- maybe an interaction with the VM setup, but I'm not sure.

 

You can gather further diagnostic logging by placing the logging.config file in your profile area (here's the SAS Note).  This will generate files with names like "cscript_log.5124.txt" (assuming you're running using cscript.exe), and the contents might reveal what's going on.  The log files are tricky for a lay person to decipher, so you might need to take it up with SAS Tech Support.  That's probably a good idea, in case there is some nuance with EG 5.1 automation that they can tell you about.

 

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
jimbarbour
Meteorite | Level 14

Chris:

 

I think I'm making some headway here.  I'm going to get a free lunch yet (I bet one of my colleagues who is an R proponent that I could automate SAS EG jobs).  🙂

 

The log file idea was a stroke of genius.

 

From the log file, I can see where SAS EG is getting ConfigurationV51.xml.  I changed ConfigurationV51.xml from:

<?xml version="1.0" encoding="utf-8"?>
<Configuration LastWrittenBy="Engine Configuration Manager">
  <Profiles />
  <Settings>
    <ActiveProfile>Null Provider</ActiveProfile>
    <GenerateLocalServer>False</GenerateLocalServer>
  </Settings>
</Configuration>

to:

<?xml version="1.0" encoding="utf-8"?>
<Configuration LastWrittenBy="Engine Configuration Manager">
  <Profiles>
    <Profile>
      <Name>barboujb</Name>
      <Description>barboujb</Description>
      <Type>OMS</Type>
      <HostName>sasp01</HostName>
      <Port>8561</Port>
      <UseIWA>False</UseIWA>
      <SaveLogin>True</SaveLogin>
      <User>barboujb</User>
      <Password>{sas002}F58A36493CF68E7202F213925067E068</Password>
      <DefaultServer>SASApp</DefaultServer>
    </Profile>
  </Profiles>
  <Settings>
    <ActiveProfile>barboujb</ActiveProfile>
    <GenerateLocalServer>False</GenerateLocalServer>
  </Settings>
</Configuration>

In other words, I added my profile to the xml config file.

 

Now, things are different.  Still not completely working, but I think I'm making progress.  From the log, I see that there is some type of COM object that is not registered properly on my machine.  

[8] SAS.EC.Directory.Metadata.OMSProvider: 2015-11-19 16:49:59,689 [1] (ERROR): Connection failed to sasp01:8561 as barboujb
[9] SAS.EC.Directory.Metadata.OMSProvider: 2015-11-19 16:49:59,689 [1] (ERROR): Message from exception follows:
[10] SAS.EC.Directory.Metadata.OMSProvider: 2015-11-19 16:49:59,689 [1] (ERROR):   Retrieving the COM class factory for component with CLSID {868CEB5F-4D78-43FC-96B4-F5B6C0341151} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
[11] SAS.EG.ProjectElements.MetadataHelper: 2015-11-19 16:49:59,689 [1] (ERROR): ConnectToRepository() - unable to connect.
SAS.EC.Directory.Metadata.MetadataException: Connection failed ---> System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {868CEB5F-4D78-43FC-96B4-F5B6C0341151} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
   at SAS.EC.Directory.Metadata.OMSProvider.MakeConnection()
   --- End of inner exception stack trace ---
   at SAS.EC.Directory.Metadata.OMSProvider.MakeConnection()
   at SAS.EC.Directory.Metadata.OMSProvider.Connect()
   at SAS.EG.ProjectElements.MetadataHelper.ConnectToProvider()

I'm not quite sure which dll I would need.  Would you happen to know which dll or can you point me to a page on sas.com that can instruct me?

 

I would also need to know how to register said dll -- although perhaps it's the same as with SASEGScripting.dll (i.e. use RegAsm.exe and RegTypeLib.exe).

 

In any event, I can practically taste that free lunch when I show the R nerds in our shop that SAS EG in fact can be automated.  🙂  Any help you can give in pointing me to the correct dll and procedures would be most appreciated.

 

Thanks,

 

Jim

ChrisHemedinger
Community Manager

That's great progress!  I hope that you plan to order steak and sushi to make the most of your free lunch.

 

The component that needs to be registered (good ol' CLSID = 868CEB5F-4D78-43FC-96B4-F5B6C0341151) is the "ObjectFactory" from the SAS Integration Technologies client.  Specifically, this is in the SASOMan.dll that is located someplace like "C:\Program Files\SASHome\Integration Technologies\SASOMan.dll".

 

Now, that DLL must already be registered in order for EG to connect to servers at all, so when you run EG interactively it's functioning okay.  But maybe with the VM nuances you've got a situation where these components are not fully available when you launch EG via automation.  Or, perhaps when running in automation like this, the Windows registry that you've got in the VM is not available to the process that's running the automation.

 

If you have the ability to run Windows PowerShell, you might be able to test this out using these techniques:

 

Using Windows PowerShell to connect to a SAS Metadata Server

Using Windows PowerShell to connect to a SAS Workspace server

 

If you had to register just SASOMan.dll, you would use the regsvr32 tool.  But if the registry doesn't already have this entry, there are likely other components missing too.   These registrations happen automatically when you install SAS Integration Technologies client, which is part of the standard EG install.  You can actually download and install this component separately, if needed.

 

Good luck!

Chris 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
jimbarbour
Meteorite | Level 14

Thanks, Chris,

 

I can practically taste that steak and sushi now.  😉

 

But lest I count the proverbial chickens before they hatch, which version of the SAS Integration Technologies Client do I need?  I see that there are four versions for SAS 9.3 as follows:

SAS_Integration_Technologies_Version.jpg

 

When I click on "Help, About, Configuration Details", I see that I have SAS version 9300.0.19933.37002.  Here's a screen shot:

SAS_Version.jpg

 

I guess I'm having trouble mapping 9300.0.19933.37002 to 93.230, .240, .250, or .260.  No doubt this is obvious to some, but for the unittiate, which version of the SAS Integration Technologies Client does SAS version 9300.0.19933.37002 correspond to?

 

Thank you,

 

Jim

ChrisHemedinger
Community Manager

Versions, shmersions.  They can be a bit confusing, am I right?

 

But the good news here is that the most recent version of SAS Integration Technologies client will serve all of your client application needs.  Just be sure to apply the proper bitness (32-bit for 32-bit EG, 64-bit for 64-bit EG).  The 9.4m3 version of the package will support EG 5.1.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
jimbarbour
Meteorite | Level 14

Chris,

 

Wow!  I never knew about half of those certifications.  Boy, am I behind.  Say, how about a SAS CLSID certification?  I mean, who doesn't want to memorize the numbers of every single SAS CLSID?  Long overdue, I say.

 

On a more serious note:  Progress continues!  I'm safely past that last exception, and, based on the log file, I can see that I've now connected to my SAS server!

2015-11-20 13:54:57,105 [11] INFO  SAS.EC.Directory.Model.Server [(null)] - Attempting connection to SASApp
2015-11-20 13:54:57,105 [11] INFO  SAS.EC.Directory.Model.Server [(null)] -   Machine: sasp01.sce.com@8591
2015-11-20 13:54:57,105 [11] INFO  SAS.EC.Directory.Model.Server [(null)] -   LogicalName: SASApp - Logical Workspace Server
2015-11-20 13:54:57,105 [11] INFO  SAS.EC.Directory.Model.Server [(null)] -   IOM options: LOCALE=en-US
2015-11-20 13:54:57,105 [11] INFO  SAS.EC.Directory.Model.Server [(null)] -   LoginMode: Cache
2015-11-20 13:54:57,105 [11] INFO  SAS.EC.Directory.Model.Server [(null)] -   Login: Authdomain = DefaultAuth, User = barboujb
2015-11-20 13:54:58,370 [11] INFO  SAS.EC.Directory.Model.Server [(null)] - Connection successful

But, alas, all is not quiet on the western front, I am now getting an IOM exception as follows;

2015-11-20 13:55:00,705 [4] ERROR SAS.EG.JobManagement.WorkspaceJob [(null)] - (Id=1) OnExecuting() - Unrecoverable error occurred
System.InvalidOperationException: The 'sas.iomprovider.1' provider is not registered on the local machine.
   at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OleDb.OleDbConnection.Open()
   at SAS.EG.JobManagement.Adapters.ExecutionWorkspaceConnection.GetMacroVariableValueFromServer(String macroVariable)
   at SAS.EG.JobManagement.Adapters.ExecutionWorkspaceConnection.InitializeConnection(IJobLog initializationLogThatCouldBeNull)
   at SAS.EG.JobManagement.Adapters.ExecutionWorkspaceConnection..ctor(String serverName, Boolean usePrimaryWorkspace, Boolean useGridIfAvailable, IJobLog initializationLogThatCouldBeNull)
   at SAS.EG.JobManagement.Adapters.WorkspaceExecutor.Connect(String serverName, IJobLog jobLog, ResultManager resultManager, Boolean usePrimaryWorkspace, Boolean useGridIfAvailable)
   at SAS.EG.JobManagement.WorkspaceJob.OnExecuting(EventArgs e)

So, after a bit of creative Googling (saaay, how about a SAS Googling certification?), 😉  I found that I need to install the SAS Providers for OLE DB.  I downloaded same, using version 9.3, and got the following message:

SAS_Deployment_Warning.jpg

 

Since the version of the SAS Providers for OLE DB matching my version of SAS didn't work, I downloaded and installed version 9.43 of the SAS Providers for OLE DB, and...  It WORKED!!  (I'll mail you some of my sushi since I've now won my "free lunch" bet)  

 

I haven't tried scheduling my vb script yet, but I've got the vb script working, so I think I'm pretty much there.

 

Short, high level summary of what I did to get a vb script to run an EG project in batch mode in an evironment with virtualized SAS EG (i.e. SAS EG isn't physically installed on the local hard drive but rather is invoked through some type of virtualization client such as Microsoft Application Virtualization Client):

1.  Generate a vb script

2.  Write a batch file that invokes the "bitness" correct version of CSscript.exe and executes the above generated vb script

3.  Download and install SASEGScripting.dll

4.  Download and install SAS Integration Technologies client

5.  Add one's profile to ConfigurationV51.xml

6.  Download and install SAS Providers for OLE DB

7.  Bug the heck out of Chris Hemedinger (essential step in this case) 🙂

 

Two notes:

1.  It would be nice if the generated vb script were named {project name}.vbs instead of just EGScript1, EGScript2, EGScript3, etc.

2.  The process I went through to get this to work is fairly laborious.  Inasmuch as companies are increasingly moving toward virtualized applications, a smoother, more automated procedure would surely be called for.  Incidentally, neither my current employer nor my previous employer has had a policy of physically installing SAS EG on individual's machines.  Both use some type of virtualized SAS EG.  My current employer uses Microsoft Application Virtualization Client.  My previous employer used Citrix.  If SAS EG wants to have a credible automation option, then I really think there's got to be a better way than the route that I went.  Even if one were armed with the knowledge of the steps I've outlined above, it might still take the better part of a day to get everything working, and the process is error prone.  Anyway, another suggestion to throw into the hopper.  🙂

 

Thanks for all your help and by golly it worked,

 

Jim

jimbarbour
Meteorite | Level 14

The above post was a bit lengthy, so I'll repeat the summary here for those who just want to skip to the answer.  I do hope that those at the SAS Institute who may be reading this will take a moment to read my concluding remarks in the preceeding post.

 

SUMMARY

This is a high level summary of what I did to get a vb script to run an EG project in batch mode in an evironment with virtualized SAS EG (i.e. SAS EG isn't physically installed on the local hard drive but rather is invoked through some type of virtualization client such as Microsoft Application Virtualization Client):

1.  Generate a vb script

2.  Write a batch file that invokes the "bitness" correct version of CSscript.exe and executes the above generated vb script

3.  Download and install SASEGScripting.dll 

4.  Download and install SAS Integration Technologies client

5.  Add one's profile to ConfigurationV51.xml

6.  Download and install SAS Providers for OLE DB

7.  Bug the heck out of Chris Hemedinger (essential step in this case) Smiley Happy

 

The above changes have to be made on one's local machine, not on virtualized drives.

 

Note:  I have only tried this with Microsoft Application Virtualization Client, but I think it would work with other virtualized forms of SAS EG such as Citrix.

 

Thanks,

 

Jim

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 4600 views
  • 2 likes
  • 2 in conversation