Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

----------------------------------INSTRUCTIONS--------------------------------------------
-Modify the following set statements. Leave the single quotes. Then run the script below.
--set @new = 'pcHostname'
--set @operatorName = 'UserNameOfInstaller'
--set @appPath = 'Velocity installation path'
--set @domain = 'Shortend domain name'
--set @sqlserverinstance = 'found in SQL Server Management studio'

-------------------------------3.8.5 or newer only-------------------------------------------
--Leave default values or enter custom values if applicable. This section will be ignored on 3.8.4 or older.
--set @VelocityUsersGroup = 'Velocity Users'
--set @VelocityServicesGroupPath = @domain or 'pcHostName'
--set @VelocityServicesAccount = 'VelocityServices'
--set @VelocityServicesGroup = 'Velocity Services'
----------------------------------INSTRUCTIONS--------------------------------------------

Expand Click expand to see SQL Script.

Expand
titleDatabase migration Script
Code Block
Use Velocity;

declare  @new nvarchar(50), @old nvarchar(50), @operatorName nvarchar(50), @appPath nvarchar(200), @domain nvarchar(200), @sqlserverinstance nvarchar (50),@VelocityUsersGroup nvarchar(50), @VelocityServicesGroupPath nvarchar(50), @VelocityServicesAccount nvarchar(50), @VelocityServicesGroup nvarchar(50) ;



set @new = 'WIN10'
set @operatorName = 'ADMINISTRATOR'
set @appPath = 'C:\Program Files (x86)\Identiv\Velocity'
set @domain = 'WIN10'
set @old = (select top 1 computername from registry where Application = 'sdserver')
set @sqlserverinstance = 'WIN10\IDENTIV'

----------------3.8.5 or newer only------------
set @VelocityUsersGroup = 'Velocity Users'
set @VelocityServicesGroupPath = @domain
set @VelocityServicesAccount = 'VelocityServices'
set @VelocityServicesGroup = 'Velocity Services'
-----------------------------------------------

if @domain = @new
	begin
		update MiscProperties
		set Value = '0'
		where Name = 'UseDomainAuthentication'
		
		update MiscProperties
		set Value = @new
		where Name = 'AuthenticationPath'

		update Operators
		set DirectorySource = '\\' + @new
	end
else
	begin
		update MiscProperties
		set Value = '1'
		where Name = 'UseDomainAuthentication'
		
		update MiscProperties
		set Value = @domain
		where Name = 'AuthenticationPath'
		
		update Operators
		set DirectorySource = '\\' + @domain
	end

if exists (select * from MiscProperties where Name = 'VelocityUsersGroup')
		begin
			update MiscProperties
			set Value = @VelocityUsersGroup
			where Name = 'VelocityUsersGroup'
		end
if exists (select * from MiscProperties where Name = 'VelocityServicesGroupPath')
		begin
			update MiscProperties
			set Value = @VelocityServicesGroupPath
			where Name = 'VelocityServicesGroupPath'
		end
if exists (select * from MiscProperties where Name = 'VelocityServicesAccount')
		begin
			update MiscProperties
			set Value = @VelocityServicesAccount
			where Name = 'VelocityServicesAccount'
		end
if exists (select * from MiscProperties where Name = 'VelocityServicesGroup')
		begin
			update MiscProperties
			set Value = @VelocityServicesGroup
			where Name = 'VelocityServicesGroup'
		end
		


update Registry
set value = @sqlserverinstance
where Property in ('ServerName','SQL Server')

update Registry
set ComputerName = @new
where ComputerName = @old

update Registry
set Value = @new
where Property in ('RemoteServerIP','RemoteIP','SDServer')

update Registry
set Value = @appPath
where ComputerName = @new and Property = 'AppPath'

update Servers
set Server_Name = @new

update ServerExtensions
set RemoteComputerName = @new

update Workstations
set WorkstationName = @new
where WorkstationID = 1

update ServerPorts
set Enabled = 0


IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS
			WHERE TABLE_NAME = 'ScheduledServiceTasks'
			AND COLUMN_NAME = 'ComputerName')
		BEGIN
			update ScheduledServiceTasks
			set ComputerName = @new
			where ComputerName = @old
		END


if not exists (select Name from Operators where Name = @operatorName)
	begin
		insert into Operators(Name, DirectorySource)
		values (@operatorName, (select top 1 directorysource from Operators))
		
		insert into OperatorsToGroups (OperatorID, GroupID)
		values ((select operatorid from Operators where Name = @operatorName), 1)
	end

...