sync
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/*=============================================================================
|
||||
TPDT-283
|
||||
|
||||
Update central system_site values for a specific OU
|
||||
|
||||
Parameters
|
||||
----------------------
|
||||
In script parameters updated from Powershell are present:
|
||||
@ou_id The id ofthe OU we need to update. This id is fetched from the local machine being migrated.
|
||||
@fqdn The FQDN of the machine being migrated to Azure. This is fetched from a DNS request, not built.
|
||||
@mac The MAC address fetched from the local machine
|
||||
|
||||
Context
|
||||
----------------------
|
||||
This script is called from a powershell in the task sequence during the migration to Azure.
|
||||
The excution context is the local pharmacy being moved to Azure, but updating the central via the linked server arizonaCash.
|
||||
It ensure that the point_of_sale table reflect the new hostname and mac address of the machine migrating to Azure
|
||||
|
||||
Creation : 04.03.2024 / TSC
|
||||
Modifications:
|
||||
07.03.2024 TSC Rewrote to connect to the central through the pharmacy linked server ArizonaCash
|
||||
The values in the local pharmacy are updated as well
|
||||
=============================================================================*/
|
||||
USE [master];
|
||||
GO
|
||||
|
||||
DECLARE @ou_id INT;
|
||||
DECLARE @fqdn VARCHAR(100) = '$fqdn';
|
||||
DECLARE @mac VARCHAR(100) = '$mac';
|
||||
|
||||
EXECUTE Arizona.[dbo].[sp_bmc_Bmc_Applic_Default]
|
||||
@in_job_type = 3,
|
||||
@in_param_int_1 = NULL, /* Company */
|
||||
@in_param_int_2 = NULL, /* Subsidiary */
|
||||
@in_param_varchar_1 = 'cvCurrentOrganizationalUnit',
|
||||
@out_default_value = @ou_id OUTPUT,
|
||||
@out_param_int_1 = NULL;
|
||||
|
||||
--central
|
||||
UPDATE ps
|
||||
SET [ps].[POS_MAC_address] = @mac
|
||||
, [ps].[POS_hostname] = @fqdn
|
||||
FROM [arizonaCash].[arizona].[dbo].[Point_of_sale] ps
|
||||
WHERE [ps].[POS_organizational_unit] = @ou_id
|
||||
AND [ps].[POS_number]=99;
|
||||
|
||||
--local
|
||||
UPDATE ps
|
||||
SET [ps].[POS_MAC_address] = @mac
|
||||
, [ps].[POS_hostname] = @fqdn
|
||||
FROM [arizona].[dbo].[Point_of_sale] ps
|
||||
WHERE [ps].[POS_organizational_unit] = @ou_id
|
||||
AND [ps].[POS_number]=99;
|
||||
Reference in New Issue
Block a user