fourbe2 C'est du sarcasme ? | Je cherche un script sql et un modèle de fichier csv/xls pour injecter mes nouvelles machines
J'avais déjà fait un script il y a 1an mais j'avais du extraire le contenu dans un fichier excel, ajouter les nouveaux pc et réinjecter le tout.
Il y avait eu quelques erreurs entre la table computeridentity et la vue computersettings car les IDs ne correspondaient pas parfaitement Je suis preneur d'un script et d'un csv qui ajouterait proprement les PC dans la table en générant la vue. Je suis pas vraiment calé en script
Ma méthode : J'injecte le contenu du csv dans une table computeridentiyNEW qui est une copie vierge de computeridentity
je lance un script
Code :
- SET IDENTITY_INSERT [MDT].[dbo].[ComputerIdentity] ON
- INSERT INTO [MDT].[dbo].[ComputerIdentity]
- (ID, Description, AssetTag, UUID, SerialNumber, MacAddress)
- SELECT ID, Description, AssetTag, UUID, SerialNumber, MacAddress
- FROM [MDT].[dbo].[ComputerIdentitynew]
- SET IDENTITY_INSERT [MDT].[dbo].[ComputerIdentity] OFF
|
puis un script qui fait la même chose entre computersettingsNEW et computersettings
Code :
- INSERT INTO [MDT].[dbo].[Settings]
- (Type,ID, UserID, UserDomain, UserPassword, UDShare, UDDir, UDProfiles, SLShare, SLShareDynamicLogging, EventShare, OSInstall, ComputerName,
- OSDComputerName, Home_Page, JoinDomain, JoinWorkGroup, DomainAdmin, DomainAdminDomain, DomainAdminPassword, MachineObjectOU,
- OSDINSTALLSILENT, OSDINSTALLPACKAGE, OSDINSTALLPROGRAM, OSDNEWMACHINENAME, ScanStateArgs, LoadStateArgs, ComputerBackupLocation,
- BackupShare, BackupDir, UserDataLocation, DoCapture, ProductKey, OverrideProductKey, WDSServer, CaptureGroups, AdminPassword, OrgName, FullName,
- TimeZone, TimeZoneName, TaskSequenceID, BuildID, KeyboardLocale, InputLocale, UserLocale, SystemLocale, UILanguage, Xresolution, Yresolution, BitsPerPel,
- Vrefresh, AreaCode, CountryCode, LongDistanceAccess, Dialing, OSDBitlockerMode, BdeInstallSuppress, BdeInstall, OSDBitLockerStartupKeyDrive,
- OSDBitLockerCreateRecoveryPassword, OSDBitLockerWaitForEncryption, BDEWaitForEncryption, BdeDriveLetter, BdeDriveSize, BdePin, BdeRecoveryKey,
- BdeKeyLocation, TpmOwnerPassword, OSDBitLockerRecoveryPassword, OSDBitLockerStartupKey, OSDMP, OSDSITECODE, DriverGroup, ServerA, ServerB, ServerC,
- ResourceRoot, FinishAction, SMSTSRunCommandLineUserName, SMSTSRunCommandLineUserPassword, USMTConfigFile, WipeDisk, _SMSTSORGNAME,
- WsusServer, USMT3, DriverSelectionProfile, PackageSelectionProfile, WizardSelectionProfile, AutoMode, AutoUsers, ApplicationSuccessCodes, BackupFile,
- SkipWizard, SkipCapture, SkipAdminPassword, SkipApplications, SkipAppsOnUpgrade, SkipComputerBackup, SkipDomainMembership, SkipComputerName,
- SkipDeploymentType, SkipUserData, SkipPackageDisplay, SkipLocaleSelection, SkipProductKey, SkipSummary, SkipFinalSummary, SkipBDDWelcome,
- SkipTimeZone, SkipBuild, SkipTaskSequence, SkipBitLocker, SkipBitLockerDetails, SkipDestinationDisk, DestinationDisk, DestinationPartition, OSDAdapterCount,
- OSDAdapter0Name, OSDAdapter0MacAddress, OSDAdapter0EnableDHCP, OSDAdapter0IPAddressList, OSDAdapter0SubnetMask, OSDAdapter0Gateways,
- OSDAdapter0GatewayCostMetric, OSDAdapter0DNSServerList, OSDAdapter0DNSSuffix, OSDAdapter0EnableDNSRegistration,
- OSDAdapter0EnableFullDNSRegistration, OSDAdapter0EnableLMHOSTS, OSDAdapter0EnableWINS, OSDAdapter0TcpipNetbiosOptions, OSDAdapter0WINSServerList,
- OSDAdapter0EnableTCPIPFiltering, OSDAdapter0TCPFilterPortList, OSDAdapter0UDPFilterPortList, OSDAdapter0IPProtocolFilterList, OSDDiskIndex, OSDPartitions,
- OSDPartitions0TYPE, OSDPartitions0FILESYSTEM, OSDPartitions0BOOTABLE, OSDPartitions0QUICKFORMAT, OSDPartitions0VOLUMENAME, OSDPartitions0SIZE,
- OSDPartitions0SIZEUNITS, OSDPartitions0VOLUMELETTERVARIABLE, OSDPartitions1TYPE, OSDPartitions1FILESYSTEM, OSDPartitions1BOOTABLE,
- OSDPartitions1QUICKFORMAT, OSDPartitions1VOLUMENAME, OSDPartitions1SIZE, OSDPartitions1SIZEUNITS, OSDPartitions1VOLUMELETTERVARIABLE,
- DoNotCreateExtraPartition, OSRoles, OSRoleServices, OSFeatures, ReplicaOrNewDomain, NewDomain, NewDomainDNSName, ParentDomainDNSName,
- ReplicaDomainDNSName, ChildName, DomainNetBiosName, ForestLevel, DomainLevel, AutoConfigDNS, ConfirmGC, CriticalReplicationOnly, ADDSUserName,
- ADDSUserDomain, ADDSPassword, ReplicationSourceDC, DatabasePath, ADDSLogPath, SysVolPath, SafeModeAdminPassword, SiteName, DHCPServerOptionRouter,
- DHCPServerOptionDNSServer, DHCPServerOptionWINSServer, DHCPServerOptionDNSDomain, DHCPServerOptionNBTNodeType, DHCPServerOptionPXEClient,
- DHCPScopes, DHCPScopes0SubnetMask, DHCPScopes0IP, DHCPScopes0Name, DHCPScopes0Description, DHCPScopes0StartIP, DHCPScopes0EndIP,
- DHCPScopes0ExcludeStartIP, DHCPScopes0ExcludeEndIP, DHCPScopes0OptionRouter, DHCPScopes0OptionDNSServer, DHCPScopes0OptionWINSServer,
- DHCPScopes0OptionDNSDomainName, DHCPScopes0OptionNBTNodeType, DHCPScopes0OptionLease, DHCPScopes0OptionPXEClient, DNSZones,
- DNSZones0Name, DNSZones0Type, DNSZones0MasterIP, DNSZones0DirectoryPartition, DNSZones0FileName, DNSZones0Scavenge, DNSZones0Update,
- DNSServerOptionDisableRecursion, DNSServerOptionBINDSecondaries, DNSServerOptionFailOnLoad, DNSServerOptionEnableRoundRobin,
- DNSServerOptionEnableNetmaskOrdering, DNSServerOptionEnableSecureCache, DNSServerOptionNameCheckFlag)
-
- SELECT Type,ID, UserID, UserDomain, UserPassword, UDShare, UDDir, UDProfiles, SLShare, SLShareDynamicLogging, EventShare, OSInstall, ComputerName,
- OSDComputerName, Home_Page, JoinDomain, JoinWorkGroup, DomainAdmin, DomainAdminDomain, DomainAdminPassword, MachineObjectOU,
- OSDINSTALLSILENT, OSDINSTALLPACKAGE, OSDINSTALLPROGRAM, OSDNEWMACHINENAME, ScanStateArgs, LoadStateArgs, ComputerBackupLocation,
- BackupShare, BackupDir, UserDataLocation, DoCapture, ProductKey, OverrideProductKey, WDSServer, CaptureGroups, AdminPassword, OrgName, FullName,
- TimeZone, TimeZoneName, TaskSequenceID, BuildID, KeyboardLocale, InputLocale, UserLocale, SystemLocale, UILanguage, Xresolution, Yresolution, BitsPerPel,
- Vrefresh, AreaCode, CountryCode, LongDistanceAccess, Dialing, OSDBitlockerMode, BdeInstallSuppress, BdeInstall, OSDBitLockerStartupKeyDrive,
- OSDBitLockerCreateRecoveryPassword, OSDBitLockerWaitForEncryption, BDEWaitForEncryption, BdeDriveLetter, BdeDriveSize, BdePin, BdeRecoveryKey,
- BdeKeyLocation, TpmOwnerPassword, OSDBitLockerRecoveryPassword, OSDBitLockerStartupKey, OSDMP, OSDSITECODE, DriverGroup, ServerA, ServerB, ServerC,
- ResourceRoot, FinishAction, SMSTSRunCommandLineUserName, SMSTSRunCommandLineUserPassword, USMTConfigFile, WipeDisk, _SMSTSORGNAME,
- WsusServer, USMT3, DriverSelectionProfile, PackageSelectionProfile, WizardSelectionProfile, AutoMode, AutoUsers, ApplicationSuccessCodes, BackupFile,
- SkipWizard, SkipCapture, SkipAdminPassword, SkipApplications, SkipAppsOnUpgrade, SkipComputerBackup, SkipDomainMembership, SkipComputerName,
- SkipDeploymentType, SkipUserData, SkipPackageDisplay, SkipLocaleSelection, SkipProductKey, SkipSummary, SkipFinalSummary, SkipBDDWelcome,
- SkipTimeZone, SkipBuild, SkipTaskSequence, SkipBitLocker, SkipBitLockerDetails, SkipDestinationDisk, DestinationDisk, DestinationPartition, OSDAdapterCount,
- OSDAdapter0Name, OSDAdapter0MacAddress, OSDAdapter0EnableDHCP, OSDAdapter0IPAddressList, OSDAdapter0SubnetMask, OSDAdapter0Gateways,
- OSDAdapter0GatewayCostMetric, OSDAdapter0DNSServerList, OSDAdapter0DNSSuffix, OSDAdapter0EnableDNSRegistration,
- OSDAdapter0EnableFullDNSRegistration, OSDAdapter0EnableLMHOSTS, OSDAdapter0EnableWINS, OSDAdapter0TcpipNetbiosOptions, OSDAdapter0WINSServerList,
- OSDAdapter0EnableTCPIPFiltering, OSDAdapter0TCPFilterPortList, OSDAdapter0UDPFilterPortList, OSDAdapter0IPProtocolFilterList, OSDDiskIndex, OSDPartitions,
- OSDPartitions0TYPE, OSDPartitions0FILESYSTEM, OSDPartitions0BOOTABLE, OSDPartitions0QUICKFORMAT, OSDPartitions0VOLUMENAME, OSDPartitions0SIZE,
- OSDPartitions0SIZEUNITS, OSDPartitions0VOLUMELETTERVARIABLE, OSDPartitions1TYPE, OSDPartitions1FILESYSTEM, OSDPartitions1BOOTABLE,
- OSDPartitions1QUICKFORMAT, OSDPartitions1VOLUMENAME, OSDPartitions1SIZE, OSDPartitions1SIZEUNITS, OSDPartitions1VOLUMELETTERVARIABLE,
- DoNotCreateExtraPartition, OSRoles, OSRoleServices, OSFeatures, ReplicaOrNewDomain, NewDomain, NewDomainDNSName, ParentDomainDNSName,
- ReplicaDomainDNSName, ChildName, DomainNetBiosName, ForestLevel, DomainLevel, AutoConfigDNS, ConfirmGC, CriticalReplicationOnly, ADDSUserName,
- ADDSUserDomain, ADDSPassword, ReplicationSourceDC, DatabasePath, ADDSLogPath, SysVolPath, SafeModeAdminPassword, SiteName, DHCPServerOptionRouter,
- DHCPServerOptionDNSServer, DHCPServerOptionWINSServer, DHCPServerOptionDNSDomain, DHCPServerOptionNBTNodeType, DHCPServerOptionPXEClient,
- DHCPScopes, DHCPScopes0SubnetMask, DHCPScopes0IP, DHCPScopes0Name, DHCPScopes0Description, DHCPScopes0StartIP, DHCPScopes0EndIP,
- DHCPScopes0ExcludeStartIP, DHCPScopes0ExcludeEndIP, DHCPScopes0OptionRouter, DHCPScopes0OptionDNSServer, DHCPScopes0OptionWINSServer,
- DHCPScopes0OptionDNSDomainName, DHCPScopes0OptionNBTNodeType, DHCPScopes0OptionLease, DHCPScopes0OptionPXEClient, DNSZones,
- DNSZones0Name, DNSZones0Type, DNSZones0MasterIP, DNSZones0DirectoryPartition, DNSZones0FileName, DNSZones0Scavenge, DNSZones0Update,
- DNSServerOptionDisableRecursion, DNSServerOptionBINDSecondaries, DNSServerOptionFailOnLoad, DNSServerOptionEnableRoundRobin,
- DNSServerOptionEnableNetmaskOrdering, DNSServerOptionEnableSecureCache, DNSServerOptionNameCheckFlag
- FROM [MDT].[dbo].[SettingsNew]
|
Message édité par fourbe2 le 21-02-2014 à 18:41:44
|