より多くのVBSはシステム・アドミニストレーターのために台本を書く

2007年3月30日8:56 AMのに掲示される

として終わる過去数年間システムAdmin、私は原稿のよい卓上、保証およびデータバックアップを経営するために数を書かなければならなかった。 私が私の環境で使用した幾つかの短い原稿はここにある!

卓上の近道を作成する方法 特別なホールダー機能を使用してdestopへの-この原稿、を使用して…参照を得ることができる従って各ユーザーのための厳密な道を心配する必要がない。 それからURLへのまたは私の場合、内部Webサーバの公正なポイント。

置きなさいWshShell = WScript.CreateObject (」 WScript.Shell」)を

strDesktop = WshShell.SpecialFolders (」卓上」)
oShellLink = WshShell.CreateShortcutを置きなさい(strDesktop及び「\サポートSite.URL」)
oShellLink.TargetPath = 「http://websvr/TechSupport」
oShellLink.Save

開始メニューで項目とホールダーを作成する方法

置きなさいFSO = CreateObject (」 Scripting.FileSystemObject」)

`は開始メニュー道を得る
strStartMenu = WshShell.SpecialFolders (」 StartMenu」)

`は最初に古い開始メニューホールダーを削除する-鉱山はAppsと呼ばれる
`はこれすべてのプログラムをかちりと鳴らすとき主要なホールダーである、私達は作成する
後の方でdeptによる`のsubfolders
NewFolder = strStartMenu及び「\プログラム\ Apps」

FSO.FolderExistsなら(NewFolder)そして
FSO.DeleteFolder NewFolder
終えなさい

`はホールダーを作り直すか、または作成する

そうでなかったらFSO.FolderExists (NewFolder)そして
FSO.CreateFolder NewFolder
終えなさい

`今私達は各部門のための補助的ホールダーを作成する
strStartMenu = WshShell.SpecialFolders (」 StartMenu」)
DeptFolder = strStartMenu及び「\プログラム\ Apps \ Dept1 ″

そうでなかったらFSO.FolderExists (DeptFolder)そして
FSO.CreateFolder DeptFolder
終えなさい

短いファイル名前問題のまわりの`の仕事
薄暗い浸水しなさい
」 subst地図を描く仕事を作るドライブ
= WshShell.Run (」 cmdの/cのsubst I浸水しなさい: c:\」、0、本当)

`はリンクをここに作成したり、サーバーの近道キー、道、および働くdirを割り当てる

oShellLink = WshShell.CreateShortcutを置きなさい(DeptFolder及び「\調査の実験室Track.lnk」)
oShellLink.TargetPath = 「i:\SearchLab\SearchLab.exe」
oShellLink.WindowStyle = 1
oShellLink.Hotkey = 「CTRL+SHIFT+S」
oShellLink.IconLocation = 「i:\SearchLab\SearchLab.exe、0の″
oShellLink.Description = 「2 -すぐに捜しなさい実験室トラックを」
oShellLink.WorkingDirectory = 「i:\SearchLab」

あなたがホールダーにより多くのリンクを加え続けることができるこのコードを上記にコピーすることによる`

`はsubstを取除く
= WshShell.Run (」 cmdの/cのsubst I浸水しなさい: /d」、0、本当)

`は開始メニューがalphatecially発注されることを確かめる
登録から削除する`は規則的な方法を使用できない。 最初にすべてのsubkeysおよびそれからによってDeleteキーを削除すること削除しなければならない

strComputer = 「」。 `の使用「」。 ローカルコンピュータのため

Const HKCU = &H80000001 `HKEY_CURRENT_USER

一定のobjRegistry = GetObject _
(」 winmgmts: {impersonationLevel=impersonate}! \ \」及びstrComputer及び「\根\デフォルト: StdRegProv」)

KillKey HKCU、「ソフトウェア\マイクロソフト\ Windows \ CurrentVersion \探検家\ MenuOrder \開始メニュー」

補助的なKillKey (のstrKey lHive)

薄暗いstrElement、IsSubscriptOutOfRange
薄暗いsKeys ()

、strKey lHive、objRegistry.EnumKey sKeys

次の間違いの概要
IsSubscriptOutOfRange = sKeys (0)

=それから誤れば0が
sKeysの各strElementのため
lHive KillKey strKey及び「\」及びstrElement
次に
終えなさい

Err.Clear
lHive objRegistry.DeleteKey strKey
端の潜水艦

文脈メニューの暗号化ファイルshorcutを可能にする方法 -これはユーザーがファイルで右クリックすることを可能にし、選ぶために暗号化しなさいファイルの特性を開けなければならないよりもむしろ。

‘ Create an object to hold a reference to the Wscript.Shell object
Dim objShell
Set objShell = WScript.CreateObject(”WScript.Shell”)

‘ Create some registry keys and values using RegWrite with objShell
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. 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”)

set WshShell = WScript.CreateObject(”WScript.Shell”)
strDesktop = WshShell.SpecialFolders(”Desktop”)
set oShellLink = WshShell.CreateShortcut(strDesktop & “\Company News.lnk”)
oShellLink.TargetPath = “K:\Public\CompanyNews.doc”
oShellLink.Save

‘ Get a reference to the Word Application object.
Set appWord = Wscript.CreateObject(”Word.Application”)
‘ Display the application.
appWord.Visible = TRUE

‘ Open ITdocument.
link = strDesktop & “\Company News.lnk”
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.

‘ Create an object to hold a reference to the Wscript.Shell object
Dim objShell
Set objShell = WScript.CreateObject(”WScript.Shell”)

‘ Create some registry keys and values using RegWrite with objShell
objshell.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters\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

If you enjoyed this post, make sure you subscribe to my RSS feed!

» Filed Under IT Job Stuff

Related Posts

Please post your comments/suggestions!