Browsing "Scripting"

How can I rename a file with todays date?

You can use this simple batch file to rename a file and append today’s date:
set Day=%Date:~0,2%
set Mth=%Date:~3,2%
set Yr=%Date:~6,4%

rename c:test.log test_%Day%-%Mth%-%Yr%.log

How can I pre-cache the Microsoft Office 2007 installation files?

Office 2007 uses the MSOCACHE folder as part of its core installation and functionality process. The folder is typically populated during the Office 2007 installation. However, to avoid network activity during installation, you can accomplish a pre-cache by performing the following steps. (Use caret brackets in place of the square brackets.)

1. From the network installation point, use Notepad to open the config.xml file, which is located in the core product folder (e.g., Pro.WW for Office Professional 2007).
2. Find the [LIS] element, and uncomment the line by deleting the opening [!-- and closing --] tags.
3. Set the [CACHEACTION] attribute to “CacheOnly”. The line in Config.xml should look like

[LIS CACHEACTION="CacheOnly" /]

4. Save the config.xml file.
5. Run setup.exe on users’ computers, specifying the fully qualified path to the modified config.xml. For example,

\[server][share]Office12setup.exe /config
\[server][share]Office12Pro.WWConfig.xml

Where can I download Windows PowerShell?

On November 15, Microsoft released Windows PowerShell 1.0 (formerly codenamed Monad) for Windows XP Service Pack 2 (SP2) and Windows Server 2003, which you can download at here . A Windows Vista Release Candidate 1 (RC1) version is also available, with the final Vista version available by January 31, 2007. The download is less than 2MB but does require that Microsoft .NET Framework 2.0 is installed. Once PowerShell is installed, a new Programs group, Windows PowerShell 1.0, will be created, which has a number of shortcuts to documents and the actual Windows PowerShell application shortcut which points to the %SystemRoot%system32WindowsPowerShellv1.0powershell.exe image.

PowerShell is the future command-line and scripting environment for the management and automation of Windows environments, and many new Microsoft technologies have their management built on the PowerShell environment. For example, Microsoft Exchange Server 2007 relies heavily on the PowerShell environment for many management actions.

The base PowerShell also includes a number of command-line tools called cmdlets that allow access to many system resources such as accessing the registry, Windows Management Instrumentation (WMI), services, processes, event logs, and basically every part of the OS.

Common cmd.exe commands such as Dir and Type all work in the PowerShell, but its real power is via its improved cmdlets. To get started, it’s easiest to type

get-help

which opens an overview of the format of the PowerShell syntax and commands to get started. For example, the get-command command will display a list of all the cmdlets, and the get-command will display detailed information on that cmdlet.

Some handy commands to get started are get-service and get-process, which give information about services and processes, respectively. The figure shows a sample search for all processes that start with o:

In this example, the information is displayed in a table format, but you can easily output it to a list by passing format-list as it’s output, as the figure shows.

To get a list of all possible formats, type

get-help format*

at a command line.

How can I migrate shares and their data between servers?

Microsoft provides the Microsoft File Server Migration Toolkit (FSMT), which you can download from Here . The tool lets you migrate shares and data from any server running Windows NT 4.0 or later to a Windows Server 2003 (or Windows Storage Server 2003) machine.

The utility also interfaces with DFS, which lets you maintain the original UNC path of the data and avoid complications with accessing data once it has been migrated. However, Windows Server 2003 Enterprise Edition lets you maintain the original UNC path, and if the old UNC path doesn’t need to be maintained, DFS isn’t required.

Are there any registry keys or files that the account specified for a performance alert requires?

When you create a performance alert, by default it runs as the Network Service account. However, you can specify a different account for its execution. If you specify another account, ensure that the named account has the following rights:

* Read access to HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionPerflib
* Full Access to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSysmonLog and its subkeys
* Read access to the files %windir%system32PERFC*.dat and %windir%system32PERFH*.dat

Pages:123»