Dim oGroup ‘ADSI object created by GetObject
Dim oWshShell ‘Shell object to run executable (smsman.exe)
Dim sInDomain ‘Used to test domain membership
Dim sCompName ‘Local computer name
Dim oWshNet ‘WshNetwork object
Dim sUser ‘Username for error checking
Dim sMember ‘Check for group membership 0 or 1
‘********************************************************
‘ Declare constants.
‘********************************************************
Const GLOBAL_GROUP = « WEBDEV » ‘Global group being added to local group
Const LOCAL_GROUP = « Administrators » ‘Name of local group
Const DOMAIN = « GONDOR » ‘Domain name
‘********************************************************
‘ Create objects.
‘********************************************************
‘Create network object.
Set oWshNet = Wscript.CreateObject(« Wscript.Network »)
‘Create shell object.
Set oWshShell = Wscript.CreateObject(« Wscript.Shell »)
‘***************************************************
‘ Get local information.
‘***************************************************
sUser = oWshNet.Username ‘Get logon name of current user.
SCompName = oWshNet.Computername ‘Get computer name.
‘***************************************************
‘Confirm Administrator is logged on; quit if not.
‘***************************************************
IF UCASE(sUser) <> « ADMINISTRATOR » THEN
Wscript.Echo « You must be logged in as « »ADMINISTRATOR » » to run this » & _
« script! » & vbCRLF & vbCRLF & « Log off and login as » & _
« » »ADMINISTRATOR » » to the local machine » & « ( » & sCompName & « ). » & _
vbCRLF & vbCRLF & « After logging in as ADMINISTRATOR, run the » & _
« C:\WINNT\SYSTEM32\FinalSetup.vbs script again » & _
» to finish the installation. »
Wscript.Quit
END IF
‘***************************************************
‘Make sure the machine has been added to the domain;
‘if not, quit and display message.
_***************************************************
‘Get key value from registry.
sInDomain = oWshShell.RegRead(« HKLM\SOFTWARE\ » & _
« Microsoft\Windows NT\CurrentVersion\Winlogon\DomainCache\GONDOR »)
IF sInDomain = « » THEN
Wscript.Echo « The Computer does not belong to » & DOMAIN & » domain! »
Wscript.quit
END IF
IF ERR.NUMBER = -2147024894 THEN
Wscript.Echo « The Computer does not belong to » & DOMAIN & » domain! »
Wscript.quit
END IF
‘********************************************************
‘ Modify group memberships.
‘********************************************************
Set oGroup = GetObject(« WinNT:// » & sCompName & « / » & LOCAL_GROUP & « ,group »)
sMember = oGroup.IsMember(« WinNT:// » & DOMAIN & « / » & GLOBAL_GROUP) ‘If a
‘member, will return -1. If not, 0.
IF sMember = 0 THEN
oGroup.add(« WinNT:// » & DOMAIN & « / » & GLOBAL_GROUP)
sMember = oGroup.IsMember(« WinNT:// » & DOMAIN & « / » & GLOBAL_GROUP)
‘If a member, will return -1. If not, 0.
IF sMember = -1 THEN
oWshShell.Popup « The » & GLOBAL_GROUP & » global group has been » & _
« successfully added to the » & LOCAL_GROUP & » local group. », & _
5, « Local Group Modified », 064
End IF
ELSE
oWshShell.Popup « The » & GLOBAL_GROUP & » global group is already » & _
» a member of the » & LOCAL_GROUP & » local group. », 5, & _
« Global Group Exists » ,064
End IF
‘********************************************************
‘Run smsman.exe to install SMS 2.0.
‘********************************************************
oWshShell.Popup « SMS 2.0 will now be installed. Please wait while » & _
» program is loading… » & vbCRLF & vbCRLF & « The SMS Client » & _
» Installation will take approximately 5 minutes to complete » & _
, 10, « SMS 2.0 Installation », 064
oWshNet.MapNetworkDrive « N: », « \\SMSCPS1\SMSLOGON », , « guest », « »
oWshShell.Run « N:\x86.bin\00000409\SMSMAN.EXE », ,TRUE
oWshNet.RemoveNetworkDrive « N: »
‘********************************************************
‘Display end-of-script message and exit.
‘********************************************************
MsgBox « This portion of the setup has been completed. » & _
« Logoff and login as the user and setup the printers. »
Pour beaucoup de DSI, le cloud a longtemps été réduit à un projet de migration : déplacer des serveurs on-premise vers un fournisseur externe. Une fois cette étape franchie, la…
Passez à la cybersécurité proactive, transformez la collecte et l’analyse des logs en un bouclier dynamique contre les cybermenaces. Découvrez comment mettre en place une approche SIEM modulaire, évolutive et…