I've been experimenting with Chris Hemedinger's scripts for using powershell to connect to a SAS workspace and run SAS jobs ( Using Windows PowerShell to connect to a SAS Workspace server - The SAS Dummy). That works but requires your loginname and password to be included in the script, which I'd like to avoid if possible. It should also be possible to connect using the "CreateObjectByLogicalName" method. There's an example here (using Python): Example of how to use SAS Workspace APIs to upload a file to a remote SAS session. Uses SAS LanguageService, FileService and BinarySteam APIs, part of IOM. The main section: # create the Integration Technologies objects objFactory = win32com.client.Dispatch("SASObjectManager.ObjectFactoryMulti2") # these xml files can be created using the SAS Integration Technologies Configutation Utility objFactory.SetMetadataFile( "C:/path/to/serverinfo.xml" , "C:/path/to/userinfo.xml" , False ) # create a connection to the SAS Workspace Server objSAS = objFactory.CreateObjectByLogicalName( "SASApp - Logical Workspace Server" , "" ) I've used ITConfig to create a default connection to the metadataserver. That creates "oms_serverinfo2.xml" and "oms_userinfo2.xml" in "%USERPROFILE%\AppData\Roaming"\SAS\MetadataServer", the latter contains my password in encrypted form. In Powershell, I create objFactory using the syntax from Chris's examples: $objFactory = New-Object -ComObject SASObjectManager.ObjectFactoryMulti2 If I understand the documentation, I should be able to connect without pointing to my metadata but I've defined that just to be sure $objFactory.SetMetadataFile( "<path>\oms_serverinfo2.xml" , "<path>r\oms_userinfo2.xml" , $FALSE ) Now, I should be able to create a workspace object using: $objSAS = $objFactory.CreateObjectByLogicalName("SASApp - Logical Workspace Server" , "" ) This doesn't work though, I get an error: Exception calling "CreateObjectByLogicalName" with "2" argument(s): "<connectionAttempts> <connectionAttempt> <description>Cannot locate an identity in metadata for the specified identity id ().</description> <status>0x80042102</status> <saslogin></saslogin> <sasmachinednsname></sasmachinednsname> <sasport>8591</sasport> <sassecuritypackage>Negotiate</sassecuritypackage> <sassecuritypackagelist>Kerberos,NTLM</sassecuritypackagelist> <sasclassid></sasclassid> <sasprogid>SAS.Workspace.1.0</sasprogid> <sasserver>SASApp - Workspace Server</sasserver> <sasdomain>DefaultAuth</sasdomain> <threadid>2280</threadid> <sasauthenticationservice>Host</sasauthenticationservice> </connectionAttempt> </connectionAttempts>" At line:1 char:48 + $objSAS = $objFactory.CreateObjectByLogicalName <<<< ("SASApp - Logical Workspace Server" , "" ) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ComMethodTargetInvocation The server doesn't seem to be able to find who I am. Does anyone know what I might be doing wrong here? The few examples I've been able to find using "CreateObjectByLogicalName" use two arguments, the server's logical name and an empty string. The SAS documentation though, specifies 4 arguments: SAS(R) 9.4 Integration Technologies: Windows Client Developer's Guide So I've also tried: $objSAS = $objFactory.CreateObjectByLogicalName("SASApp", $TRUE, "SASApp - Logical Workspace Server" , "") In that case, I get an error Cannot find an overload for "CreateObjectByLogicalName" and the argument count: "4". At line:1 char:48_te + $objSAS = $objFactory.CreateObjectByLogicalName <<<< ("SASApp", $TRUE, "SASApp - Logical Workspace Server" , "" ) + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : MethodCountCouldNotFindBest That sounds like I just shouldn't be using 4 arguments. Hope someone can help with this. The SAS server runs SAS 9.4, the server itself is Windows 2008 R2.
... View more