More VBS Scripts for System Administrators اكثر vbs مخطوطات لمديري النظام

Posted on March 30, 2007 at 8:56 am نشرت فى 30 مارس ، 2007 في 8:56 صباحا

Over the past few years as a Systems Admin, I’ve had to write a good number of scripts to manage desktops, security, and data backup. على مدى السنوات القليلة الماضية نتيجة لنظم الادارة ، وقد قمت لكتابة عدد لا بأس به من مخطوطات لإدارة أجهزة كمبيوتر ، والأمن ، والتخزين الاحتياطي للبيانات. Here are a couple of short scripts that I’ve used in my environment! هنا اثنين من الكتابات القصيره التي قمت المستخدمة في بلادي البيئة!

How to create a shortcut on the desktop - Using this script, you can get a reference to the destop using the special folders function, so you don’t have to worry about the exact path for each user. كيف تصنع الاختصار على سطح المكتب - باستخدام هذا البرنامج النصي ، يمكنك ان تحصل إشارة إلى destop باستخدام المجلدات الخاصة وظيفة ، لذا لا داعي للقلق حول المسار المحدد لكل مستخدم. Then just point to a URL or in my case, an internal web server. ثم عادل تشير الى موقع او في حالتي ، داخلي ملقم الويب.

set WshShell = WScript.CreateObject(”WScript.Shell”) مجموعة wshshell = wscript.createobject ( "wscript.shell")

strDesktop = WshShell.SpecialFolders(”Desktop”) Strdesktop = wshshell.specialfolders ( "المكتب")
set oShellLink = WshShell.CreateShortcut(strDesktop & “\Support Site.URL”) مجموعة oshelllink = wshshell.createshortcut (strdesktop & "\ دعم site.url")
oShellLink.TargetPath = “http://websvr/TechSupport” Oshelllink.targetpath = "http://websvr/techsupport"
oShellLink.Save Oshelllink.save

How to create a folder with items in the Start Menu كيف تصنع مجلد مع البنود في قائمة أبدا

Set FSO = CreateObject(”Scripting.FileSystemObject”) مجموعة fso = createobject ( "scripting.filesystemobject")

‘Get the start menu path 'تحصل على قائمة أبدا الطريق
strStartMenu = WshShell.SpecialFolders(”StartMenu”) Strstartmenu = wshshell.specialfolders ( "startmenu")

‘First delete the old start menu folder - mine is called Apps 'الاولى تحذف القديمة قائمة أبدا مجلد الالغام يسمى بتطبيقات
‘ This is the main folder when you click All Programs, then we’ll create 'هذا هو اهم مجلد عندما تنقر على جميع البرامج ، ثم سنقوم بانشاء
‘ subfolders by dept later on 'المجلدات الفرعية به في وقت لاحق على قسم
NewFolder = strStartMenu & “\Programs\Apps” Newfolder = strstartmenu & "\ برامج \ تطبيقات"

If FSO.FolderExists( NewFolder ) then اذا fso.folderexists (newfolder) ثم
FSO.DeleteFolder NewFolder Fso.deletefolder newfolder
end if نهاية إذا

‘Re-Create or create the folder 'اعادة تهيئة أو تهيئة مجلد

If NOT FSO.FolderExists( NewFolder ) then اذا لم fso.folderexists (newfolder) ثم
FSO.CreateFolder NewFolder Fso.createfolder newfolder
End if نهاية إذا

‘Now we create sub-folders for each department 'الآن نقوم بانشاء المجلدات الفرعية في كل ادارة
strStartMenu = WshShell.SpecialFolders(”StartMenu”) Strstartmenu = wshshell.specialfolders ( "startmenu")
DeptFolder = strStartMenu & “\Programs\Apps\Dept1″ Deptfolder = strstartmenu & "\ برامج \ تطبيقات \ dept1"

If NOT FSO.FolderExists( DeptFolder ) then اذا لم fso.folderexists (deptfolder) ثم
FSO.CreateFolder DeptFolder Fso.createfolder deptfolder
End if نهاية إذا

‘Work around the short file name problem 'عمل حول القصير مشكلة اسم الملف
Dim ret قاتمه نقع
’subst a drive to make the mapping work 'Subst حملة لجعل العمل ورسم الخرائط
ret = WshShell.Run (”cmd /c subst i: c:\”, 0, TRUE) نقع = wshshell.run ( "CMD / ج subst الاول : ج : \" ، 0 ، صحيح)

‘Create the links here, assign shortcut keys, path on server, and working dir 'خلق الروابط هنا ، واسناد مفاتيح الاختصار ، عن طريق الخادم ، والعمل دير

set oShellLink = WshShell.CreateShortcut(DeptFolder & “\Search Lab Track.lnk”) مجموعة oshelllink = wshshell.createshortcut (deptfolder & "\ البحث معمل track.lnk")
oShellLink.TargetPath = “i:\SearchLab\SearchLab.exe” Oshelllink.targetpath = "الاول : \ searchlab \ searchlab.exe"
oShellLink.WindowStyle = 1 Oshelllink.windowstyle = 1
oShellLink.Hotkey = “CTRL+SHIFT+S” Oshelllink.hotkey = "السيطرة تحول + + ق"
oShellLink.IconLocation = “i:\SearchLab\SearchLab.exe, 0″ Oshelllink.iconlocation = "الاول : \ searchlab \ searchlab.exe ، 0"
oShellLink.Description = “2 - Search Lab Track quickly” Oshelllink.description = "2 - البحث في مختبر المسار بسرعة"
oShellLink.WorkingDirectory = “i:\SearchLab” Oshelllink.workingdirectory = "الاول : \ searchlab"

‘ You can continue to add more links into the folder, by copying this code above 'يمكنك الاستمرار في اضافة المزيد من الروابط في مجلد ، ونسخ هذه المدونه اعلاه

‘remove the subst 'ازالة subst
ret = WshShell.Run (”cmd /c subst i: /d”, 0, TRUE) نقع = wshshell.run ( "CMD / ج subst الاول : / د" ، 0 ، صحيح)

‘Make sure the start menu is alphatecially ordered 'التأكد من قائمة أبدا هو alphatecially امرت
‘Deleting from the registry, can’t use regular method. 'حذف من قلم ، لا يمكن استخدام الطريقة العاديه. Must delete by first deleting all subkeys and then deleting key يجب ان تحذف من جانب أول حذف جميع subkeys وثم حذف الرئيسية

strComputer = “.” ‘ use “.” for local computer Strcomputer = "." استخدام "-" لحاسوبيه محلية

Const HKCU = &H80000001 ‘HKEY_CURRENT_USER Const hkcu = & h80000001 'hkey_current_user

Set objRegistry = GetObject _ مجموعة objregistry = getobject _
(”winmgmts:{impersonationLevel=impersonate}!\\” & strComputer & “\root\default:StdRegProv”) ( "Winmgmts : (impersonationlevel = قلد)! \ \" & Strcomputer & "\ الجذريه \ الافتراضي : stdregprov")

KillKey HKCU, “Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu” Killkey hkcu ، "برامج \ مايكروسوفت \ نوافذ \ currentversion \ اكسبلورر \ menuorder \ قائمة ابدا"

Sub KillKey(lHive, strKey) الفرعي killkey (lhive ، strkey)

Dim strElement, IsSubscriptOutOfRange قاتمه strelement ، issubscriptoutofrange
Dim sKeys() قاتمه skeys ()

objRegistry.EnumKey lHive, strKey, sKeys Objregistry.enumkey lhive ، strkey ، skeys

On Error Resume Next على خطأ استئناف المقبل
IsSubscriptOutOfRange = sKeys(0) Issubscriptoutofrange = skeys (0)

If Err = 0 Then اذا اخطأ = 0 ثم
For Each strElement In sKeys لكل strelement في skeys
KillKey lHive, strKey & “\” & strElement Killkey lhive ، strkey & "\" & strelement
Next القادم
End If نهاية إذا

Err.Clear Err.clear
objRegistry.DeleteKey lHive, strKey Objregistry.deletekey lhive ، strkey
End Sub نهاية الفرعية

How to enable the Encrypt File shorcut in the context menu - This will allow a user to right click on a file and choose Encrypt, rather than having to open the properties of the file. كيفية تمكين شفر ملف shorcut في سياق القائمة - وهذا سيسمح للمستخدم حق انقر على الملف واختيار شفر ، بدلا من الاضطرار الى فتح ملف أملاك.

‘ Create an object to hold a reference to the Wscript.Shell object 'تهيئة الجسم لعقد اشارة الى wscript.shell وجوه
Dim objShell قاتمه objshell
Set objShell = WScript.CreateObject(”WScript.Shell”) مجموعة objshell = wscript.createobject ( "wscript.shell")

‘ Create some registry keys and values using RegWrite with objShell 'خلق بعض المفاتيح وقلم القيم باستخدام regwrite مع objshell
objshell.RegWrite “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EncryptionContextMenu”, 1, “REG_DWORD” Objshell.regwrite "hklm \ برامج \ مايكروسوفت \ نوافذ \ currentversion \ اكسبلورر \ متقدمة \ encryptioncontextmenu" ، 1 ، "reg_dword"

How to open a Word document from your file server automatically - This little script does nothing but create a link to a Word Doc off the file server and then opens it. كيفية فتح كلمة وثيقة من ملفك خادم تلقائيا وهذا النص لا يفعل شيئا قليلا ولكن ايجاد صلة الى كلمة الدكتور قبالة خادم ملف وبعد ذلك يفتح له. You can add some code to maybe open on the file only on Mondays, maybe like a once a week update to the company. يمكنك اضافة الى بعض المدونه ربما مفتوحة على الملف الا على أيام الاثنين ، وربما مثل مرة واحدة في الاسبوع لتحديث الشركة. Then all you have to do is update the Word file on the server. ثم جميع عليك ان تفعله هو استكمال لفظة الملف على الخادم.

Set FSO = CreateObject(”Scripting.FileSystemObject”) مجموعة fso = createobject ( "scripting.filesystemobject")

set WshShell = WScript.CreateObject(”WScript.Shell”) مجموعة wshshell = wscript.createobject ( "wscript.shell")
strDesktop = WshShell.SpecialFolders(”Desktop”) Strdesktop = wshshell.specialfolders ( "المكتب")
set oShellLink = WshShell.CreateShortcut(strDesktop & “\Company News.lnk”) مجموعة oshelllink = wshshell.createshortcut (strdesktop & "\ شركة news.lnk")
oShellLink.TargetPath = “K:\Public\CompanyNews.doc” Oshelllink.targetpath = "ك : \ العام \ companynews.doc"
oShellLink.Save Oshelllink.save

‘ Get a reference to the Word Application object. 'تحصل على الاشارة الى كلمة تطبيق وجوه.
Set appWord = Wscript.CreateObject(”Word.Application”) مجموعة appword = wscript.createobject ( "word.application")
‘ Display the application. 'عرض الطلب.
appWord.Visible = TRUE Appword.visible = صحيح

‘ Open ITdocument. 'مفتوحة itdocument.
link = strDesktop & “\Company News.lnk” وصلة = strdesktop & "\ شركة news.lnk"
appWord.Documents.Open(link) Appword.documents.open (لينك)

How to remove admin shares from a computer - This greatly increases security as long as you’re not using Admin shares on any of your desktops. كيفية ازالة الادارة سهم من الحاسوب وهذا يزيد كثيرا من الامن طالما انك لا تستخدم الادارة على أسهم أي من أجهزة كمبيوتر الخاص بك.

‘ Create an object to hold a reference to the Wscript.Shell object 'تهيئة الجسم لعقد اشارة الى wscript.shell وجوه
Dim objShell قاتمه objshell
Set objShell = WScript.CreateObject(”WScript.Shell”) مجموعة objshell = wscript.createobject ( "wscript.shell")

‘ Create some registry keys and values using RegWrite with objShell 'خلق بعض المفاتيح وقلم القيم باستخدام regwrite مع objshell
objshell.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters\AutoShareWks”, 0, “REG_DWORD” Objshell.regwrite "hklm \ نظام \ currentcontrolset \ خدمات \ lanmanserver \ بارامترات \ autosharewks" ، 0 ، "reg_dword"

I’ll post some more later on when I have time! أنا أكثر منك بعد انتهاء وقت لاحق عن بعض عندما يتوفر لدي الوقت!

Related Posts: الوظائف ذات الصلة :

Top things Windows System Administrators should and should not do! كبار مديري النظام ويندوز اشياء يجب وينبغي ألا تفعل!

VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script Vbs النصي لمديري النظام - كيفية الاحتياطيه التوقعات البريد الالكتروني تلقائيا في تسجيل الدخول او الانقطاع النصي

If you enjoyed this post, make sure you اذا كنت تتمتع هذه الوظيفة ، تأكد انك subscribe to my RSS feed ار اس اس للاكتتاب بلدي الغذاء ! !

» Filed Under »المقدمة تحت IT Job Stuff انه عمل stuff

Related Posts الوظائف ذات الصلة

Please post your comments/suggestions! الرجاء تعليقاتكم وظيفة / اقتراحات!