Hello, I'm looking for ways to automate a SAS EG 7.1 project using PowerShell as the process that I currently execute is a monthly process and it is done manually as of now. I would want to automate the process so that the project runs thru every month automatically on the scheduled date and time. The project is currently exporting an excel spreadsheet on to the SharePoint site and would like that spreadsheet automatically generated every month based on the new source data. The SAS EG project connects to the remote server using login id and credentials. I have the below sample code in Powershell which executes the SAS EG project but unable to see the results anywhere- $objFactory = New-Object -ComObject SASObjectManager.ObjectFactoryMulti2 $objServerDef = New-Object -ComObject SASObjectManager.ServerDef $objServerDef.MachineDNSName = "Workspace Server Name" # SAS Workspace node $objServerDef.Port = xxxx # workspace server port $objServerDef.Protocol = 2 # 2 = IOM protocol # Class Identifier for SAS Workspace $objServerDef.ClassIdentifier = "440196d4-90f0-11d0-9f41-00a024bb830c" # create and connect to the SAS session $objSAS = $objFactory.CreateObjectByServer( "Server Name", # server name $true, $objServerDef, # built server definition "XXXX", # user ID "YYYYY" # password ) # program to run # could be read from external file $program = Get-Content "C:\TestCode.egp"; # run the program $objSAS.LanguageService.Submit($program); # flush the output - could redirect to external file Write-Output "Output:" $list = "" do { $list = $objSAS.LanguageService.FlushList(1000) Write-Output $list } while ($list.Length -gt 0) # flush the log - could redirect to external file Write-Output "LOG:" $log = "" do { $log = $objSAS.LanguageService.FlushLog(1000) Write-Output $log } while ($log.Length -gt 0) # end the SAS session $objSAS.Close() Thanks!
... View more