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.
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.