wackou

Windows 7 Post-installation script

Dec 22nd, 2012
2,168
0
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. ' www.wackou.com
  11.  
  12. If WScript.Arguments.length =0 Then
  13.   Set objShell = CreateObject("Shell.Application")
  14.   'Pass a bogus argument with leading blank space, say [ uac]
  15.  objShell.ShellExecute "wscript.exe", Chr(34) & _
  16.   WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
  17. Else
  18.  
  19. Dim strDomainGroup, strLocalGroup, strLocalGroup2, Action
  20.  
  21. Action = "Add" ' or Remove
  22. strLocalGroup = "Administrators"
  23. strLocalGroup2 = "Administrateurs"
  24. strDomainGroup = "admins_global"
  25.  
  26. On Error Resume Next
  27.  
  28. Dim strDomain, strComputer
  29. Dim objNetwork, objLocalGroup, objDomainGroup
  30.  
  31. Set objNetwork = CreateObject("WScript.Network")
  32. strDomain = objNetwork.UserDomain 'DOMAINE
  33. strComputer = objNetwork.ComputerName 'NOM DU PC
  34.  
  35. Set objLocalGroup = GetObject("WinNT://" & _
  36.                     strComputer & "/" & strLocalGroup)
  37. Set objLocalGroup2 = GetObject("WinNT://" & _
  38.                     strComputer & "/" & strLocalGroup2)                    
  39. Set objDomainGroup = GetObject("WinNT://" & _
  40.                     strDomain & "/" & strDomainGroup)
  41.  
  42. ' Do Work
  43. Select Case Action
  44.     Case "Remove"
  45.         objLocalGroup.Remove(objDomainGroup.ADsPath)
  46.         objLocalGroup2.Remove(objDomainGroup.ADsPath)
  47.     Case "Add"
  48.         objLocalGroup.Add(objDomainGroup.ADsPath)
  49.         objLocalGroup2.Add(objDomainGroup.ADsPath)
  50. End Select
  51.  
  52. 'COMPTE SUPPORTER
  53. Set colAccounts = GetObject("WinNT://" & strComputer & "")
  54. Set objUser = colAccounts.Create("user", "supporter")
  55. objUser.SetPassword "P@$$w0rd"
  56. objUser.SetInfo
  57. objLocalGroup.Add(objUser.ADsPath) 'AJOUT DANS GROUPE Administrators
  58. objLocalGroup2.Add(objUser.ADsPath) 'AJOUT DANS GROUPE Administrateurs
  59. 'UTILISATEUR NE PEUT PAS CHANGER SON MDP
  60. Flags = objUser.Get("UserFlags")
  61. objUser.Put "Userflags", flags OR &H0040
  62. objUser.SetInfo
  63. 'MDP N'EXPIRE PAS
  64. Flags = objUser.Get("UserFlags")
  65. objUser.Put "Userflags", flags OR &H10000
  66. objUser.SetInfo
  67.  
  68. 'COPIE POLICE
  69. Const FONTS = &H14&
  70. Set objShell = CreateObject("Shell.Application")
  71. Set objFolder = objShell.Namespace(FONTS)
  72. objFolder.CopyHere "Y:\W92.FON"
  73.  
  74. 'COPIE MFGPRO SUR LE BUREAU
  75. Const OverwriteExisting = True
  76. Set objShell = CreateObject("Wscript.Shell")
  77. Set objFolders = objShell.SpecialFolders
  78. Set objFSO = CreateObject("Scripting.FileSystemObject")
  79. strDesktop = objFolders("Desktop")
  80. objFSO.CopyFile "Y:\MFGPRO.lnk", strDesktop & "\", OverwriteExisting
  81.  
  82. 'LANCER INSTALL ACCESS97
  83. Set WshShell = WScript.CreateObject("WScript.Shell")
  84. WshShell.Run "Y:\Access97.lnk"
  85.  
  86. 'INVENTAIRE
  87. Set WshShell = WScript.CreateObject("WScript.Shell")
  88. WshShell.Run "Y:\ocsinventory.exe /server=http://server_ocs/ocsinventory /np /force /hkcu"  
  89.  
  90.  
  91. ' Clean up objects
  92. Set objDomainGroup = Nothing
  93. Set objLocalGroup = Nothing
  94. Set objLocalGroup2 = Nothing
  95. Set objNetwork = Nothing
  96. Set colAccounts = Nothing
  97. Set objUser = Nothing
  98. Set objShell = Nothing
  99. Set objFolders = Nothing
  100. Set objFSO = Nothing
  101. Set WshShell = Nothing
  102.  
  103. End If
Advertisement
Add Comment
Please, Sign In to add comment