Hello,
I launch my SAS Enterprise Guide projects via powershell scripts. I would like to know if it is possible to inform my password from the powershell and that the project sas guide the recovery then?
I do not know if I'm clear.
Thanks
%global password;
/* Connection serveur */
options comamid=tcp;
%let server=server 0000;
signon noscript remote=server user="%upcase(&userid.)" password="%upcase(&password.)";
Are you talking about the user/password that you need to supply to connect to SAS metadata/workspace? If so, then use the credentials.xml scheme. Here's the SAS note:
http://support.sas.com/kb/30/917.html
(Update the version-specific folder location for your version of EG.)
If you're talking about Prompts that you've built in with project prompts, then you need to use the Prompts property/methods in the EG automation API.
Get the Project.Parameters, returns a ParameterList, which you can navigate as name-value item pairs. (Sorry -- I don't have an example handy.)
Or, if you just want to initialize these macro variables, use Project.CodeCollection.Add to add a new program with this code, use the Run method, and then run the rest of the project/flow. Example here.
Chris
Thanks Chris,
I'm talking about the user / password I need to provide to connect to the SAS metadata / workspace? I create a file credentials.xml but it doesn't work.
I have the SAS Guide 7.1 version.
credentials.xml :
<xml FileVersion ="7.1"> <credentials><server name="server1" userid="id" password="pwd"/><server name="server2" userid="id" password="pwd"/></credentials></xml>
I put it in the folder %appdata%\SAS\EnterpriseGuide\7.1 and %allusersprofile%\SAS\SharedSettings\7.1
I run my script powershell
##############
$rep_projet="C:\Users\.............."
$rep_log="C:\Users\.............."
##############
$eguideApp = New-Object -comObject SASEGObjectModel.Application.7.1
$projName = "$rep_projet\project.egp"
$project = $eguideApp.Open("$projName", "")
$projectLog = $project.ProjectLog
# Show all of the process flows in the project
$pfCollection = $project.ContainerCollection
######################
Write-Host "Clearing the project log in EG project: " $project
# Clear the project log:
$projectLog.Clear()
# Other available project log operation examples...
# Enable/disable project log:
$projectLog.Enabled = $true
# Get project log text:
$strProjectLog = $projectLog.Text
Write-Host "Project log text: " $strProjectLog
$pf=$pfCollection.item("DG Hebdo")
Write-Host " EXECUTION FLUX DE PROCESSUS " $pf.Name
# To RUN a process flow, simply use $pf.Run()
$pf.Run()
# Save project log to a file:
$projectLog.SaveAs("$rep_log\Log_proj.txt")
$project.Close()
$eguideApp.Quit()
I have the following error (see attachment).
Thanks for your help
Isek
Those look like the correct steps. You can turn on Application Logging (Tools->Options) and EG should generate a POWERSHELL*.log file in your profile folder. Some messages in there might indicate what's missing. If you can't solve it, I suggest opening a SAS Tech Support case.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.