awsswaawsswa
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Цепляем принтер //***************************************************** //JScript 2005 ShS addPrn.js //Подключение сетевого принтера и установка его принтером по умолчанию //Пример запуска: %LOGONSERVER%\NETLOGON\addPrn.js \\PrintServer\HPLJ2200DN(23) //***************************************************** var WshNetwork, objArgs, strErrMsg, strPrinterPath; //Путь к подключаемому принтеру берем из параметров запуска objArgs=WScript.Arguments.Unnamed; strPrinterPath=objArgs.Item(0); // WshNetwork=WScript.CreateObject("Wscript.Network"); try { WshNetwork.AddWindowsPrinterConnection(strPrinterPath); WshNetwork.SetDefaultPrinter(strPrinterPath); } catch (objError) { if (objError !=0) { strErrMsg = "Произошла ошибка при пордключении сетевого принтера - "+strPrinterPath+"\n"+ "Скорее всего узанный сетевой путь не существует"+"\n\n"+ "Обратитесь к системному администратору по тел. 128" //"Код ошибки: "+ objError.number; WScript.Echo(strErrMsg); } } Добавлено: Актуальный скриптик - запись 1с в реест Dim oShell Set oShell = CreateObject("WScript.Shell") sRegKey = "HKCU\Identities" ' C ошибками нафиг On Error Resume Next If Not oShell Is Nothing Then sProfileLoaded2 = oShell.RegRead( sRegKey & "\Super_exe") ' а есть ли метки ? If sProfileLoaded2 <> "yes" Then ' запись метки в реестр и запуск остального '-------------------------------------------------------------------------- Set WSShell = WScript.CreateObject("WScript.Shell") Set oShell = CreateObject("WScript.Shell") WSShell.Run ("regedit /s \\server\NETLOGON\1C_реестр_запись.reg"), 1, true '-------------------------------------------------------------------------- oShell.RegWrite sRegKey & "\Super_exe", "yes" Else ' а если метка была тупо пропускаем ход End If ' Free object again Set oShell = Nothing End If а вот тот кусок реестра который пихается под именем 1C_реестр_запись.reg Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\1C\1Cv7\7.7\Titles] "\\\\Server\\1C_BASE\\1C_Superfirma_2007\\"="Бухгалтерия Суперфирмы" "\\\\Server\\1C_BASE\\ДемоБаза\\"="Демобаза" Добавлено: А вот актуальность под названием автоматическоя настройка Outlook 2003 имя Outlook.prf --------------------------------------------------------------------------------------- ; ************************************************************** ; Section 1 - Profile Defaults ; outlook.exe /importprf \\proxima-srv1\netlogon\outlook.prf ; Delete the following registry key values: ; HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Setup\First-Run ; HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Setup\FirstRun ; In the HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Setup ; subkey, set the value of ImportPRF to a string value that specifies the name and path of the PRF file. ; For example, set ImportPRF to \\server1\share\outlook.prf. ; ************************************************************** [General] Custom=1 DefaultProfile=Yes ;OverwriteProfile=Append OverwriteProfile=Yes ModifyDefaultProfileIfPresent=TRUE ; ************************************************************** ; Section 2 - Services in Profile ; ************************************************************** [Service List] Service1=Microsoft Exchange Server ServiceEGS=Exchange Global Section ;*************************************************************** ; Section 4 - Default values for each service. ;*************************************************************** [ServiceEGS] MailboxName=%UserName% HomeServer=server.firma.local ; Name of the new Exchange Server [Service1] OverwriteExistingService=No UniqueService=Yes MailboxName=%UserName% HomeServer=server.firma.local ; Name of the new Exchange Server AccountName=Microsoft Exchange Server ;*************************************************************** ; Section 6 - Mapping for profile properties ;*************************************************************** [Microsoft Exchange Server] ServiceName=MSEMS MDBGUID=5494A1C0297F101BA58708002B2A2517 MailboxName=PT_STRING8,0x6607 HomeServer=PT_STRING8,0x6608 OfflineAddressBookPath=PT_STRING8,0x660E OfflineFolderPath=PT_STRING8,0x6610 [Exchange Global Section] SectionGUID=13dbb0c8aa05101a9bb000aa002fc45a MailboxName=PT_STRING8,0x6607 HomeServer=PT_STRING8,0x6608 RPCoverHTTPflags=PT_LONG,0x6623 RPCProxyServer=PT_UNICODE,0x6622 RPCProxyPrincipalName=PT_UNICODE,0x6625 RPCProxyAuthScheme=PT_LONG,0x6627 CachedExchangeConfigFlags=PT_LONG,0x6629 [Personal Folders] ServiceName=MSPST MS Name=PT_STRING8,0x3001 PathToPersonalFolders=PT_STRING8,0x6700 RememberPassword=PT_BOOLEAN,0x6701 EncryptionType=PT_LONG,0x6702 Password=PT_STRING8,0x6703 [Outlook Address Book] ServiceName=CONTAB [LDAP Directory] ServiceName=EMABLT ServerName=PT_STRING8,0x6600 UserName=PT_STRING8,0x6602 UseSSL=PT_BOOLEAN,0x6613 DisplayName=PT_STRING8,0x3001 ConnectionPort=PT_STRING8,0x6601 SearchTimeout=PT_STRING8,0x6607 MaxEntriesReturned=PT_STRING8,0x6608 SearchBase=PT_STRING8,0x6603 [Microsoft Outlook Client] SectionGUID=0a0d020000000000c000000000000046 FormDirectoryPage=PT_STRING8,0x0270 WebServicesLocation=PT_STRING8,0x0271 ComposeWithWebServices=PT_BOOLEAN,0x0272 PromptWhenUsingWebServices=PT_BOOLEAN,0x0273 OpenWithWebServices=PT_BOOLEAN,0x0274 [Personal Address Book] ServiceName=MSPST AB NameOfPAB=PT_STRING8,0x001e3001 Path=PT_STRING8,0x001e6600 ShowNamesBy=PT_LONG,0x00036601 ---------------------------------------------------------------------------------------- конец Добавлено: а вот теперь уже скрипт для Outlook cleanOutlook.vbs ------------------------------------------------------------------------------ Dim oShell Set oShell = CreateObject("WScript.Shell") sRegKey = "HKCU\Identities" ' C ошибками нафиг On Error Resume Next If Not oShell Is Nothing Then sProfileLoaded2 = oShell.RegRead( sRegKey & "\Super_outlook_run") ' а есть ли метки ? If sProfileLoaded2 <> "yes" Then ' запись метки в реестр и запуск остального '-------------------------------------------------------------------------- ' clean.vbs Const HKEY_CURRENT_USER = &H80000001 sComputer = "." Set oRegistry=GetObject("winmgmts:\\" & _ sComputer & "\root\default:StdRegProv") sKeyPath = "Software\Microsoft\Office\11.0\Outlook\Setup" sValueName = "First-Run" oRegistry.DeleteValue HKEY_CURRENT_USER, sKeyPath, _ sValueName '-------------------------------------------------------------------------- oShell.RegWrite sRegKey & "\Super_outlook_run", "yes" Else ' а если метка была тупо пропускаем ход End If ' Free object again Set oShell = Nothing End If ------------------------------------------------------------------------------------------------- Добавлено: а теперь сома запись уже в реестр Outlook_path.vbs ------------------------------------------------------------------------------- Dim oShell Set oShell = CreateObject("WScript.Shell") sRegKey = "HKCU\Identities" ' C ошибками нафиг On Error Resume Next If Not oShell Is Nothing Then sProfileLoaded2 = oShell.RegRead( sRegKey & "\Super_outlook_path") ' а есть ли метки ? If sProfileLoaded2 <> "yes" Then ' запись метки в реестр и запуск остального '-------------------------------------------------------------------------- ' Outlook.vbs Const HKEY_CURRENT_USER = &H80000001 sComputer = "." Set oRegistry=GetObject("winmgmts:\\" & _ sComputer & "\root\default:StdRegProv") sKeyPath = "Software\Microsoft\Office\11.0\Outlook\Setup" oRegistry.CreateKey HKEY_CURRENT_USER, sKeyPath sValue = "\\server\netlogon\Outlook.prf" sValueName = "ImportPRF" oRegistry.SetStringValue HKEY_CURRENT_USER, _ sKeyPath, sValueName, sValue '-------------------------------------------------------------------------- oShell.RegWrite sRegKey & "\Super_outlook_path", "yes" Else ' а если метка была тупо пропускаем ход End If ' Free object again Set oShell = Nothing End If ---------------------------------------------------------------------------- конец |