More VBS Scripts for System Administrators Mehr VBS Scripts für Systemadministratoren
Posted on March 30, 2007 at 8:56 am Erschienen am 30. März 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. Im Laufe der letzten Jahre als Systems Admin, ich habe zu schreiben eine große Anzahl von Drehbüchern für die Verwaltung von Desktops, Sicherheit, und der Datensicherung. Here are a couple of short scripts that I’ve used in my environment! Hier sind ein paar kurze Skripte, die ich in meiner Umgebung!
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. Wie erstelle ich eine Verknüpfung auf dem Desktop - mit diesem Script, können Sie einen Verweis auf die destop mit dem speziellen Ordner Funktion, so dass Sie sich keine Sorgen um den genauen Pfad für die einzelnen Benutzer. Then just point to a URL or in my case, an internal web server. Dann einfach auf eine URL oder in meinem Fall, einen internen Webserver.
set WshShell = WScript.CreateObject(”WScript.Shell”) Set WshShell = WScript.CreateObject ( "WScript.Shell")
strDesktop = WshShell.SpecialFolders(”Desktop”) StrDesktop = WshShell.SpecialFolders ( "Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & “\Support Site.URL”) Satz oShellLink = WshShell.CreateShortcut (strDesktop & "\ Support 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 Wie erstelle ich einen Ordner mit Gegenständen im Startmenü
Set FSO = CreateObject(”Scripting.FileSystemObject”) Set FSO = CreateObject ( "Scripting.FileSystemObject")
‘Get the start menu path "Holen Sie sich den Weg Startmenü
strStartMenu = WshShell.SpecialFolders(”StartMenu”) StrStartMenu = WshShell.SpecialFolders ( "StartMenu")
‘First delete the old start menu folder - mine is called Apps "Zunächst löschen Sie die alte Startmenü Ordner - Mine wird Apps
‘ This is the main folder when you click All Programs, then we’ll create "Dies ist das wichtigste Ordner, wenn Sie auf" Alle Programme ", dann erstellen wir
‘ subfolders by dept later on "Unterordner von Abt. später
NewFolder = strStartMenu & “\Programs\Apps” NewFolder = strStartMenu & "\ Programme \ Apps"
If FSO.FolderExists( NewFolder ) then Wenn FSO.FolderExists (NewFolder), dann
FSO.DeleteFolder NewFolder FSO.DeleteFolder NewFolder
end if Ende, wenn
‘Re-Create or create the folder "Neu erstellen oder den Ordner erstellen
If NOT FSO.FolderExists( NewFolder ) then Wenn NICHT FSO.FolderExists (NewFolder), dann
FSO.CreateFolder NewFolder FSO.CreateFolder NewFolder
End if Ende, wenn
‘Now we create sub-folders for each department "Jetzt schaffen wir Unterordner für jede Abteilung
strStartMenu = WshShell.SpecialFolders(”StartMenu”) StrStartMenu = WshShell.SpecialFolders ( "StartMenu")
DeptFolder = strStartMenu & “\Programs\Apps\Dept1″ DeptFolder = strStartMenu & "\ Programme \ Apps \ Dept1"
If NOT FSO.FolderExists( DeptFolder ) then Wenn NICHT FSO.FolderExists (DeptFolder), dann
FSO.CreateFolder DeptFolder FSO.CreateFolder DeptFolder
End if Ende, wenn
‘Work around the short file name problem "Die Arbeiten rund um den kurzen Dateinamen Problem
Dim ret Dim ret
’subst a drive to make the mapping work 'Subst-if ein Laufwerk, um die Zuordnung der Arbeit
ret = WshShell.Run (”cmd /c subst i: c:\”, 0, TRUE) Ret = WshShell.Run ( "cmd" / k subst-if ich c: \ ", 0, TRUE)
‘Create the links here, assign shortcut keys, path on server, and working dir "Erstellen Sie die Links hier, weisen Sie Tastaturkürzel, Pfad auf dem Server, und arbeiten Richtung
set oShellLink = WshShell.CreateShortcut(DeptFolder & “\Search Lab Track.lnk”) Satz oShellLink = WshShell.CreateShortcut (DeptFolder & "\ Search Lab Track.lnk")
oShellLink.TargetPath = “i:\SearchLab\SearchLab.exe” OShellLink.TargetPath = "Die i: \ SearchLab \ SearchLab.exe"
oShellLink.WindowStyle = 1 OShellLink.WindowStyle = 1
oShellLink.Hotkey = “CTRL+SHIFT+S” OShellLink.Hotkey = "CTRL + SHIFT + S"
oShellLink.IconLocation = “i:\SearchLab\SearchLab.exe, 0″ OShellLink.IconLocation = "Die i: \ SearchLab \ SearchLab.exe, 0"
oShellLink.Description = “2 - Search Lab Track quickly” OShellLink.Description = "2 - Suche Lab Track schnell"
oShellLink.WorkingDirectory = “i:\SearchLab” OShellLink.WorkingDirectory = "Die i: \ SearchLab"
‘ You can continue to add more links into the folder, by copying this code above "Sie können weiterhin um mehr Links in den Ordner, durch Kopieren Sie diesen Code oben
‘remove the subst "Entfernen der subst-if
ret = WshShell.Run (”cmd /c subst i: /d”, 0, TRUE) Ret = WshShell.Run ( "cmd" / k subst-if der i: / d "0, TRUE)
‘Make sure the start menu is alphatecially ordered "Stellen Sie sicher, dass das Startmenü ist alphatecially bestellt
‘Deleting from the registry, can’t use regular method. "Löschen aus der Registry, nicht verwenden können normale Methode. Must delete by first deleting all subkeys and then deleting key Muss löschen, indem Sie zuerst alle Unterschlüssel löschen und dann Löschen Schlüssel
strComputer = “.” ‘ use “.” for local computer StrComputer = "." ' "." Für den lokalen Computer
Const HKCU = &H80000001 ‘HKEY_CURRENT_USER Const HKCU = & H80000001 'HKEY_CURRENT_USER
Set objRegistry = GetObject _ Set objRegistry = GetObject _
(”winmgmts:{impersonationLevel=impersonate}!\\” & strComputer & “\root\default:StdRegProv”) ( "Winmgmts: (impersonationLevel = Identität)! \ \ "& StrComputer &" \ Root \ Default: StdRegProv ")
KillKey HKCU, “Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu” KillKey HKCU, "Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ MenuOrder \ Start Menü"
Sub KillKey(lHive, strKey) Sub KillKey (lHive, strKey)
Dim strElement, IsSubscriptOutOfRange Dim strElement, IsSubscriptOutOfRange
Dim sKeys() Dim sKeys ()
objRegistry.EnumKey lHive, strKey, sKeys ObjRegistry.EnumKey lHive, strKey, sKeys
On Error Resume Next Bei einem Fehler bei der nächsten
IsSubscriptOutOfRange = sKeys(0) IsSubscriptOutOfRange = sKeys (0)
If Err = 0 Then Wenn Err = 0 Dann
For Each strElement In sKeys Für Jeder strElement In sKeys
KillKey lHive, strKey & “\” & strElement KillKey lHive, strKey & "\" & strElement
Next Weiter
End If Ende Wenn
Err.Clear
objRegistry.DeleteKey lHive, strKey ObjRegistry.DeleteKey lHive, strKey
End Sub 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. Wie kann ich eine Datei shorcut im Verschlüsseln Sie das Kontextmenü - Dieser Fall kann ein Nutzer der rechten Maustaste auf eine Datei und wählen Sie Verschlüsseln, anstatt auf die Eigenschaften der Datei.
‘ Create an object to hold a reference to the Wscript.Shell object "Erstellen Sie ein Objekt, eine Bezugnahme auf die Wscript.Shell Objekts
Dim objShell Dim objShell
Set objShell = WScript.CreateObject(”WScript.Shell”) Set objShell = WScript.CreateObject ( "WScript.Shell")
‘ Create some registry keys and values using RegWrite with objShell 'Erstellen einige Registry Schlüssel und Werte mit RegWrite mit objShell
objshell.RegWrite “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EncryptionContextMenu”, 1, “REG_DWORD” Objshell.RegWrite "HKLM \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Advanced \ 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. Wie kann ich ein Word-Dokument öffnen Sie die Datei von Server automatisch - Dieses kleine Skript macht nichts, aber ein Link zu einem Word Dokument aus der Datei und dann öffnet sie. You can add some code to maybe open on the file only on Mondays, maybe like a once a week update to the company. Sie können einen Code zu öffnen vielleicht auf die Datei nur am Montag, wie vielleicht einmal in der Woche ein Update für das Unternehmen. Then all you have to do is update the Word file on the server. Dann alles, was Sie zu tun haben, ist das Update Word Datei auf dem Server.
Set FSO = CreateObject(”Scripting.FileSystemObject”) Set FSO = CreateObject ( "Scripting.FileSystemObject")
set WshShell = WScript.CreateObject(”WScript.Shell”) Set WshShell = WScript.CreateObject ( "WScript.Shell")
strDesktop = WshShell.SpecialFolders(”Desktop”) StrDesktop = WshShell.SpecialFolders ( "Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & “\Company News.lnk”) Satz oShellLink = WshShell.CreateShortcut (strDesktop & "\ Firma News.lnk")
oShellLink.TargetPath = “K:\Public\CompanyNews.doc” OShellLink.TargetPath = "K: \ Public \ CompanyNews.doc"
oShellLink.Save OShellLink.Save
‘ Get a reference to the Word Application object. "Holen Sie sich ein Verweis auf das Word Application Objekt.
Set appWord = Wscript.CreateObject(”Word.Application”) Set appWord = Wscript.CreateObject ( "Word.Application")
‘ Display the application. 'Zeigt die Anwendung.
appWord.Visible = TRUE AppWord.Visible = TRUE
‘ Open ITdocument. 'Open ITdocument.
link = strDesktop & “\Company News.lnk” Link = strDesktop & "\ Firma News.lnk"
appWord.Documents.Open(link) AppWord.Documents.Open (Link)
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. Wie entferne ich Admin Aktien von einem Computer - Dies erhöht die Sicherheit, solange Sie nicht mit Admin Aktien auf alle Ihre Desktops.
‘ Create an object to hold a reference to the Wscript.Shell object "Erstellen Sie ein Objekt, eine Bezugnahme auf die Wscript.Shell Objekts
Dim objShell Dim objShell
Set objShell = WScript.CreateObject(”WScript.Shell”) Set objShell = WScript.CreateObject ( "WScript.Shell")
‘ Create some registry keys and values using RegWrite with objShell 'Erstellen einige Registry Schlüssel und Werte mit RegWrite mit objShell
objshell.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters\AutoShareWks”, 0, “REG_DWORD” Objshell.RegWrite "HKLM \ SYSTEM \ CurrentControlSet \ Services \ LanManServer \ Parameters \ AutoShareWks", 0, "REG_DWORD"
I’ll post some more later on when I have time! Ich werde nach etwas mehr später, wenn ich Zeit haben!
Related Posts: Verwandte Beiträge:
Bookmark, Share or Email this article. Lesezeichen, Aktie oder Email diesem Artikel.
If you enjoyed this post, make sure you Wenn Ihnen dieser Post, machen Sie sicher, dass Sie subscribe to my RSS feed Abonnieren meinem RSS-Feed ! !
» Filed Under »Unter Abgelegt IT Job Stuff IT-Arbeitsmarkt Stuff
Related Posts Verwandte Beiträge
- VBS Script for System Administrators - How to backup Outlook email automatically in a login or logoff script VBS Script für Systemadministratoren - Wie zur Unterstützung von Outlook E-Mails automatisch in eine Anmeldung oder Logoff Script
- How to pin a folder to the Start Menu in Windows XP Wie kann ich einen Ordner, in dem Pin dem Startmenü von Windows XP
- How to back up or save a Word document automatically before your computer crashes! Wie kann ich zurück nach oben oder Speichern eines Word-Dokuments automatisch vor Ihrem Computer stürzt ab!
- How to view the product keys for Microsoft Windows XP or Office XP/2003 for free Wie kann ich das Produkt Schlüssel für Microsoft Windows XP oder Office XP/2003 kostenlos
- How to save your desktop icon layout in Windows XP So speichern Sie Ihren Desktop Icon Layout in Windows XP
























