How to send Parameter values to a VBScript for removing roles from command line?

Posted: February 12, 2014 in Uncategorized

————————–Invalid_BK.vbs———–name of the vbscript file —————-

sQCUrl = “http://alm/qcbin”
sUsername = “User_Name”
sPassword = “Password”
sQCDomain = “DEFAULT”
sQCProject = WScript.Arguments(0)
sQCUser = WScript.Arguments(1)
Set tdc = CreateObject(“TDApiOle80.TDConnection”) ‘tdc Object set successfully, and i can see sub objects availability
tdc.InitConnectionEx sQCUrl
‘at above line I am getting General run error
MsgBox “Initiated the ALM connection”
tdc.Login sUsername, sPassword ‘QC Authentication
If (tdc.LoggedIn True) Then
MsgBox “User ” & sUsername & ” Authentication to ALM is Fail”
End If

tdc.Connect sQCDomain, sQCProject ‘QC Project Login
MsgBox “Connected to the project”
If (tdc.Connected True) Then
MsgBox “ALM Project Failed to Connect to ” & sQCProject
End If
Set cust = tdc.Customization
cust.Load
Set custUsers = cust.Users
Set users = custUsers.Users
For Each usr in users
If usr.Name = sQCUser Then
If usr.InGroup(“Inactive”) = True Then
usr.RemoveFromGroup(“Inactive”)
MsgBox “Invalid role removed for “& sQCUser
End If
End If
Next
cust.Commit()
Set cust = Nothing
Set custUsers = Nothing
Set users = Nothing
If tdc.Connected Then : tdc.Disconnect
If tdc.LoggedIn Then : tdc.Logout
——————————————————————————————–

Run command prompt and execute the below.

C:\Users\UserName\Desktop>cscript.exe Invalid_BK.vbs “Project_Name” “User_Name”

——————————————————————————————–

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s