Apologies, I don't have SAS so working from memory.
I thought that when you installed SAS IT, it would install a small client program for testing. It is in your Windows Menu under SAS Integration Technologies. Use that to get your client working before putting it into PowerShell.
Here is some C# code I have used with references to InterOp.ADODB, SAS, SASObjectManager, SASWorkspaceManager). I have lots of code around this area so ping if needed and I will drop on github. When given a choice, I prefer C# to PowerShell. Both are good but C# is easier to read and maintain, IMO:
private Workspace CreateWorkspace()
{
Workspace sasWorkspace;
try
{
var objFactory = new ObjectFactoryClass();
var serverDef = new ServerDefClass();
// ************************************************
// Configure the SAS server information.
// ************************************************
serverDef.BridgeEncryptionAlgorithm = "SASProprietary";
serverDef.BridgeEncryptionLevel = EncryptionLevels.EncryptUserAndPassword;
serverDef.MachineDNSName = DnsName;
serverDef.Port = Port;
serverDef.Protocol = Protocols.ProtocolBridge;
// ************************************************
// Create the connection.
// ************************************************
sasWorkspace =
(Workspace) objFactory.CreateObjectByServer("BridgeConnection", true, serverDef, UserId, Password);
}
catch (Exception ex)
{
util.HandleError(MethodBase.GetCurrentMethod().Name, ex);
return null;
}
return sasWorkspace;
}
... View more