BookmarkSubscribeRSS Feed
isek
Obsidian | Level 7

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.)";
3 REPLIES 3
ChrisHemedinger
Community Manager

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

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
isek
Obsidian | Level 7

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

 

 

 

 

ChrisHemedinger
Community Manager

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.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1299 views
  • 2 likes
  • 2 in conversation