daily pastebin goal
21%
SHARE
TWEET

Windows 7 Post-installation script

wackou Dec 22nd, 2012 1,724 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' Ajoute le groupe Admins_global dans le groupe administrateurs
  2. ' Créé un utilisateur local et l'ajoute dans le groupe Administrateurs.
  3. ' Installe la police W92.FON,
  4. ' Copie le raccourcie MFGPRO sur le bureau de l'utilisateur
  5. ' Installe Access 97
  6. ' Il fait un inventaire du poste
  7. '
  8. '
  9. ' Wackou
  10. ' contact@wackou.com
  11. ' www.wackou.com
  12.  
  13. If WScript.Arguments.length =0 Then
  14.   Set objShell = CreateObject("Shell.Application")
  15.   'Pass a bogus argument with leading blank space, say [ uac]
  16.  objShell.ShellExecute "wscript.exe", Chr(34) & _
  17.   WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
  18. Else
  19.  
  20. Dim strDomainGroup, strLocalGroup, strLocalGroup2, Action
  21.  
  22. Action = "Add" ' or Remove
  23. strLocalGroup = "Administrators"
  24. strLocalGroup2 = "Administrateurs"
  25. strDomainGroup = "admins_global"
  26.  
  27. On Error Resume Next
  28.  
  29. Dim strDomain, strComputer
  30. Dim objNetwork, objLocalGroup, objDomainGroup
  31.  
  32. Set objNetwork = CreateObject("WScript.Network")
  33. strDomain = objNetwork.UserDomain 'DOMAINE
  34. strComputer = objNetwork.ComputerName 'NOM DU PC
  35.  
  36. Set objLocalGroup = GetObject("WinNT://" & _
  37.                                         strComputer & "/" & strLocalGroup)
  38. Set objLocalGroup2 = GetObject("WinNT://" & _
  39.                                         strComputer & "/" & strLocalGroup2)                                    
  40. Set objDomainGroup = GetObject("WinNT://" & _
  41.                                         strDomain & "/" & strDomainGroup)
  42.  
  43. ' Do Work
  44. Select Case Action
  45.         Case "Remove"
  46.                 objLocalGroup.Remove(objDomainGroup.ADsPath)
  47.                 objLocalGroup2.Remove(objDomainGroup.ADsPath)
  48.         Case "Add"
  49.                 objLocalGroup.Add(objDomainGroup.ADsPath)
  50.                 objLocalGroup2.Add(objDomainGroup.ADsPath)
  51. End Select
  52.  
  53. 'COMPTE SUPPORTER
  54. Set colAccounts = GetObject("WinNT://" & strComputer & "")
  55. Set objUser = colAccounts.Create("user", "supporter")
  56. objUser.SetPassword "P@$$w0rd"
  57. objUser.SetInfo
  58. objLocalGroup.Add(objUser.ADsPath) 'AJOUT DANS GROUPE Administrators
  59. objLocalGroup2.Add(objUser.ADsPath) 'AJOUT DANS GROUPE Administrateurs
  60. 'UTILISATEUR NE PEUT PAS CHANGER SON MDP
  61. Flags = objUser.Get("UserFlags")
  62. objUser.Put "Userflags", flags OR &H0040
  63. objUser.SetInfo
  64. 'MDP N'EXPIRE PAS
  65. Flags = objUser.Get("UserFlags")
  66. objUser.Put "Userflags", flags OR &H10000
  67. objUser.SetInfo
  68.  
  69. 'COPIE POLICE
  70. Const FONTS = &H14&
  71. Set objShell = CreateObject("Shell.Application")
  72. Set objFolder = objShell.Namespace(FONTS)
  73. objFolder.CopyHere "Y:\W92.FON"
  74.  
  75. 'COPIE MFGPRO SUR LE BUREAU
  76. Const OverwriteExisting = True
  77. Set objShell = CreateObject("Wscript.Shell")
  78. Set objFolders = objShell.SpecialFolders
  79. Set objFSO = CreateObject("Scripting.FileSystemObject")
  80. strDesktop = objFolders("Desktop")
  81. objFSO.CopyFile "Y:\MFGPRO.lnk", strDesktop & "\", OverwriteExisting
  82.  
  83. 'LANCER INSTALL ACCESS97
  84. Set WshShell = WScript.CreateObject("WScript.Shell")
  85. WshShell.Run "Y:\Access97.lnk"
  86.  
  87. 'INVENTAIRE
  88. Set WshShell = WScript.CreateObject("WScript.Shell")
  89. WshShell.Run "Y:\ocsinventory.exe /server=http://server_ocs/ocsinventory /np /force /hkcu"  
  90.  
  91.  
  92. ' Clean up objects
  93. Set objDomainGroup = Nothing
  94. Set objLocalGroup = Nothing
  95. Set objLocalGroup2 = Nothing
  96. Set objNetwork = Nothing
  97. Set colAccounts = Nothing
  98. Set objUser = Nothing
  99. Set objShell = Nothing
  100. Set objFolders = Nothing
  101. Set objFSO = Nothing
  102. Set WshShell = Nothing
  103.  
  104. End If
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top