* Adapted the powershell to connect to the central with a dedicated sql login
* reverted script 9_Update_FTPLogin_Central to the original version
* script 9_Update_FTPLogin_Central is executed on the central directly with a dedicated login
* reverted scripts 20_update_system_site_centrale.sql and 21_update_point_of_sale_centrale.sql to work locally only
*  scripts scripts 20_update_system_site_centrale.sql and 21_update_point_of_sale_centrale.sql are executed on the cenrtal with a specific login and on the local instance
* when fetching the mac addresses, only take up interfaces in account and group the results by mac addresses, to avoid virtual mac addresses duplicate causing an error
This commit is contained in:
2024-03-15 11:23:24 +01:00
parent 6903f71717
commit 88a89d84fe
4 changed files with 93 additions and 168 deletions

View File

@@ -6,7 +6,7 @@ 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.
@ou_id The id of the 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.
@alias The alias of the machine being migrated to Azure. This is logically built from the FQDN
@@ -20,38 +20,14 @@ 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
15.03.2024 TSC Went back to a local update. this script will be run both locally and on the central from the powershell executing it
=============================================================================*/
USE [master];
DECLARE @ou_id INT;
DECLARE @ou_id INT = $ou_id;
DECLARE @fqdn VARCHAR(100) = '$fqdn';
DECLARE @alias VARCHAR(100) = '$alias';
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 ss
SET [ss].[SS_server_name] = @alias
, [ss].[SS_IP_server_address] = @alias
, [ss].[SS_domain_name] = @fqdn
FROM [arizonaCash].[arizona].[dbo].[Organizational_unit] ou
JOIN [arizonaCash].[arizona].[dbo].[System_site] ss ON ss.[System_site_ID] = ou.[OU_system_site]
WHERE ou.[Organizational_unit_ID] = @ou_id;
UPDATE ssi
SET [ssi].[SSSI_SQL_instance_name] = @alias+'\APSSQL'
FROM [arizonaCash].[arizona].[dbo].[Organizational_unit] ou
JOIN [arizonaCash].[arizona].[dbo].[System_site] ss ON ss.[System_site_ID] = ou.[OU_system_site]
JOIN [arizonaCash].[arizona].[dbo].[System_site_SQL_instance] ssi ON ssi.[SSSI_system_site] = ss.[System_site_ID]
WHERE ou.[Organizational_unit_ID] = @ou_id;
--local
UPDATE ss
SET [ss].[SS_server_name] = @alias
, [ss].[SS_IP_server_address] = @alias