I'm trying to capture the Username of Connections Profile via vbscript. Below is the code and the link where I referenced from :
http://support.sas.com/resources/papers/proceedings12/298-2012.pdf
' force declaration of variables in VB Script
Option Explicit
Dim Application
' Create a new SAS Enterprise Guide automation session
Set Application = WScript.CreateObject("SASEGObjectModel.Application.7.1")
WScript.Echo Application.Name & ", Version: " & Application.Version
' Discover the available profiles that are defined for the current user
Dim i
Dim oShell
Set oShell = CreateObject( "WScript.Shell" )
WScript.Echo "Metadata profiles available for " _
& oShell.ExpandEnvironmentStrings("%UserName%")
WScript.Echo "----------------------------------------"
For i = 0 to Application.Profiles.Count-1
WScript.Echo "Profile available: " _
& Application.Profiles.Item(i).Name _
& ", Host: " & Application.Profiles.Item(i).HostName _
& ", Port: " & Application.Profiles.Item(i).Port
Next
Application.Quit
Is there a way to retrieve USER of the Profile as well? I've already tried something like Application.Profiles.Item(i).User or Application.Profiles.Item(i).Username, but didn't get the desired result.
Please suggest.
Thank You.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.