Nsib

Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Цитата: Привет мужики неподскажите как можно сделать такой скрип который бы при появлении новой машины в домене начал автоматически заливать софт(например ICQ,Winrar и.т.д) с сетевого диска на эту машину | Запускаешь логин-скрипт под системной учетной записью и при входе ситема начинает установку или обновление установленных программ. 'Update.vbs Dim WshLogonPath Set WshShell = WScript.CreateObject("WScript.Shell") On Error Resume Next If WshShell.FileExists("\\Controller\Scripts$\iChat.vbs") Then WshShell.Run "\\Controller\Scripts$\iChat.vbs", 0, True End If If WshShell.FileExists("\\Controller\Scripts$\RAdmin.vbs") Then WshShell.Run "\\Controller\Scripts$\RAdmin.vbs", 0, True End If If WshShell.FileExists("\\Controller\Scripts$\Update_key_DrWeb.vbs") Then WshShell.Run "\\Controller\Scripts$\Update_key_DrWeb.vbs", 0, True End If If WshShell.FileExists("\\Controller\Scripts$\Update_2Gis.vbs") Then WshShell.Run "\\Controller\Scripts$\Update_2Gis.vbs", 0, True End If If WshShell.FileExists("\\Controller\Scripts$\Ti.vbs") Then WshShell.Run "\\Controller\Scripts$\Ti.vbs", 0, True End If If WshShell.FileExists("\\Controller\Scripts$\WinRar.vbs") Then WshShell.Run "\\Controller\Scripts$\WinRar.vbs", 0, True End If И для примера Update_2Gis.vbs Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Dim Path Dim Bases Dim Base Set WSHShell = WScript.CreateObject("WScript.Shell") Path = "" On Error Resume Next GetErr1() if Err.Source="WshShell.RegRead" then Err.Clear GetErr2() if Err.Source="WshShell.RegRead" then WshShell.Popup "Обратитесь к Администратору для установки ДубльГИС ",10 else Path = WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TechnoGrad\DoubleGIS\1.0\Path\") Path = Left(Path,Len(Path)-4) GetDate() end if else Path = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TechnoGrad\DoubleGIS\1.0\All\") GetDate() end if Err.Clear Function GetErr1() If WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TechnoGrad\DoubleGIS\1.0\All\") Then End If End Function Function GetErr2() If WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TechnoGrad\DoubleGIS\1.0\Path\") Then End If End Function Function GetDate() Set lfsObject = CreateObject("Scripting.FileSystemObject") Set File1 = lfsObject.GetFile(Path & "\Nsk\grym.exe") Set File2 = lfsObject.GetFile("\\Controller\Scripts$\Update\2gis\Nsk\grym.exe") If File1.DateLastModified <> File2.DateLastModified Then CopyFiles "\\Controller\Scripts$\Update\2gis", Path Lnk() WSHShell.Popup "Обновление ДубльГИС завершино",10 End If End Function Function CopyFiles(strSourceDir, strDestDir) On Error Resume Next Set lfsObject = CreateObject("Scripting.FileSystemObject") Set lFolder = lfsObject.GetFolder(strSourceDir) If strSourceDir > "" then Set NewFolder = lfsObject.CreateFolder(strDestDir) Set lFileList = lFolder.Files For Each lFile in lFileList lfsObject.CopyFile strSourceDir & "\" & lFile.Name, strDestDir & "\" & lFile.Name Next Set lSubFolders = lFolder.SubFolders For Each lSubFolder in lSubFolders NewSource = strSourceDir & "\" & lSubFolder.Name NewDest = strDestDir & "\" & lSubFolder.Name CopyFiles NewSource, NewDest Next End If Set lfsObject = Nothing Set lFileList = Nothing Set lFolder = Nothing Set lFile = Nothing End Function Function Lnk() Set lfsObject = CreateObject("Scripting.FileSystemObject") AllUsersPrograms = WSHShell.SpecialFolders("AllUsersPrograms") If lfsObject.FolderExists(AllUsersPrograms & "\ДубльГИС") Then Set lFolder = lfsObject.GetFolder(AllUsersPrograms & "\ДубльГИС") else Set lFolder = lfsObject.CreateFolder(AllUsersPrograms & "\ДубльГИС") End If Set Bases = CreateObject("Scripting.Dictionary") Bases.Add "Астрахань" , "Astrakhan" Bases.Add "Барнаул" ,"Barnaul" Bases.Add "Екатеринбург" ,"Ekaterinburg" Bases.Add "Иркутск" ,"Irkutsk" Bases.Add "Кемерово" ,"Kemerovo" Bases.Add "Красноярск" ,"Krasnoyarsk" Bases.Add "Курган" ,"Kurgan" Bases.Add "Нижневартовск" ,"Nizhnevartovsk" Bases.Add "Новокузнецк" ,"Novokuznetsk" Bases.Add "Новосибирск" ,"Nsk" Bases.Add "Омск" ,"Omsk" Bases.Add "Томск" ,"Tomsk" Bases.Add "Тюмень" ,"Tyumen" For Each Base in Bases Set WshShortcut = WshShell.CreateShortcut(lFolder & "\" & Base & ".lnk") WshShortcut.IconLocation = Path & "\" & Bases.Item(Base) & "\grym.exe" WshShortcut.TargetPath = Path & "\" & Bases.Item(Base) & "\grym.exe" WshShortcut.WindowStyle = 1 WshShortcut.WorkingDirectory = Path & "\" & Bases.Item(Base) WshShortcut.Save Next Set lfsObject = Nothing Set lFolder = Nothing Set Gis = Nothing End Function |