New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Absent Member.
Absent Member.
570 views

User Migrations from Test to Prod Environment

Hi,

 

How do I migrate all user avilable from one Site (Test) environment to another (Prod) site in one go.

Is there any way ?

 

Thanks,

KF

0 Likes
2 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Depending on your backend database you could extract/backup the relevant tables in the one environment and restore them in the other environment.  Or, you could look at using the Site Admin API to extract the data from the one environment and insert it into the other environment. 

[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

you can export all the users from the test system using a vb script which saves all the details to xml (except for the users password):

 

Set fso = CreateObject("Scripting.FileSystemObject")

'==============================================================================================================================
' Connect to QC Site Admin
'==============================================================================================================================
Set f = fso.OpenTextFile ("d:\temp\getallusers.log", 2, True)
f.WriteLine(Now)
f.WriteLine("Connect to QC Site Admin...")

Set sa = CreateObject("SAClient80MP.SAapi")
result = sa.Login ("http://qc/sabin", "site_admin_username", "password")
f.WriteLine(result)

'==============================================================================================================================
' Get all users
'==============================================================================================================================
f.WriteLine("Getting all user details from QC...")
result = sa.GetAllUsers

' Create XML file
Set x = fso.OpenTextFile ("c:\temp\getallusers.xml", 2, True)
x.WriteLine(result)
x.Close

f.WriteLine(Now)
f.Close

 

you can then use the Xml file as an input file to create the users on your Prod system using this import vb script:

 

'==============================================================================================================================
' Read XML file created by getallusers.vbs in c:\temp
'==============================================================================================================================
set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("c:\temp\getallusers.xml")

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile ("c:\temp\createusers.log", 2, True)
f.WriteLine(Now)


'==============================================================================================================================
' Connect to QC Site Admin
'==============================================================================================================================
f.WriteLine("Connect to QC Site Admin...")
Set sa = CreateObject("SAClient80MP.SAapi")
result = sa.Login ("http://qc/sabin", "qcadmin_user", "password")
f.WriteLine(result)

'==============================================================================================================================
' Create User in 9.2
'==============================================================================================================================
' Example of XML values:
'0<USER_ID>12518</USER_ID>
'1<USER_NAME>sqwerty</USER_NAME>
'2<ACC_IS_ACTIVE>Y</ACC_IS_ACTIVE>
'3<FULL_NAME>Scott Qwerty</FULL_NAME>
'4<LAST_UPDATE>1221549756000</LAST_UPDATE>
'5<USERS_VERSION>1221549756000</USERS_VERSION>
'6<US_REPORT_ROLE>0</US_REPORT_ROLE>
'7<DOMAIN_ID>0</DOMAIN_ID>
'8<DOMAIN_NAME>Templates</DOMAIN_NAME>
'9<EMAIL>Scott.Qwert@somewhere.com.au</EMAIL>
'10<USER_PASSWORD>456202</USER_PASSWORD>
'11<DESCRIPTION></DESCRIPTION>
'12<PHONE_NUMBER></PHONE_NUMBER>
'13<US_DOM_AUTH></US_DOM_AUTH>


   Set root = xmlDoc.documentElement
   For i = 0 To (root.childNodes.length - 1)
		if i > 0 then
		UserName = root.childNodes.Item(i).childNodes.Item(1).Text
		FullName = root.childNodes.Item(i).childNodes.Item(3).Text
		Email = root.childNodes.Item(i).childNodes.Item(9).Text
		Phone = root.childNodes.Item(i).childNodes.Item(12).Text
		Description = root.childNodes.Item(i).childNodes.Item(11).Text
		password = ""
		result = ""
		'Public Function CreateUser( _
		'   ByVal UserName As String, _
		   'ByVal FullName As String, _
		   'ByVal Email As String, _
		   'ByVal Phone As String, _
		   'ByVal Description As String, _
		   'ByVal password As String _
		') As String
		On Error Resume Next
		result = sa.CreateUser (UserName,FullName,Email,Phone,Description,password)
		f.WriteLine(result)
		if result = "" then
			result = "Username " & UserName & " already exists, skipped."
			f.WriteLine(result)
		end if
	
		end if
   Next

f.WriteLine("Script finished")
f.WriteLine(Now)
f.close


 

The import script will skip a username if it already exists, and has been tested in qc8, 9 and 11 (with minor modifications with Alm 11 around the login function and xml values).

 

Robert Barcikowski
Senior Technical Specialist
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.