Tag Archives: Bat

Use Scandinavian Characters in a Command-line script (BAT)

Purpose: You are in a need to use special characters (ie. Scandinavian Characters) in a Batch script.

You might notice that the default settings of Windows 7 CMD.exe does not allow you to call a script with Special Characters (ie. Scandinavian Characters). This occurs only when you call a Batch script from the CMD.exe. Typing directly in an open CMD session allows you to work with special characters. You can easily bypass the special character problem on your own workstation but might not be that straightforward to deploy the changes into your domain.

Continue Reading

Backup a local folder to a network drive with user interaction (BAT)

Purpose: Create a small backup program that a user can launch as he likes

In a corporate environment, different methods of backups are used. However, there might be a need for a small group of people to create something special. The need might raise for those who use an application that requires the USERS to be able to backup the application themselves. This of course puts the backup process into different set of hands (the user) but if that is the wish – it can be done and most importantly – easily. This example assumes that the network drive is backuped with other methods.

Continue Reading

Add or modify an environmental variable (BAT, VBS)

Purpose: Add or modify a windows OS environmental variable from command-line

It is not very unusual that an application requires an environmental variable to function properly. Depending on how deep into the application packaging you must dive, sooner or later you will be face to face with an environmental variable application. Most common scenarios is that something will work a lot easier with a custom environmental variable or that the actual windows PATH variable must be modified to include the new application.

The most important theory is the following:

User environmental variables: HKEY_CURRENT_USER\Environment
System enviromental variables: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

Continue Reading

Change a computer name from the command-line

Purpose: Demonstrate different ways to change a computer name remotely using command-line

There are multiple reasons why you might need to change a computer name remotely. One might be that you are lazy. The other might be that you would disturbt the user if you change his workstation name with a RDP (or similar) connection. The third might be that you creating are a tool and want to use your command line as a function to it. What ever your case is, here are my foundings about this subject.

Continue Reading

Allow limited users to install fonts in Windows 7 with UAC turned on (BAT)

Purpose: Allow non-administrator / limited user to install fonts in W7 with UAC turned on

Since the Windows 7 operating system has been published, the Web has been full of questions about how to allow limited users to install fonts in a corporate environment. There are not many ways available, unless you really want to lower the security of your OS and change the way the OS is supposed to work. However there is at least one way to allow this: first you need to change the way you have tried to approach this problem. You can install the fonts to a user session instead of the local machine. You will need to create a system that will make sure that the fonts are kept in the user session even after a system reboot or for another user.

Usage: IT_APP_BAT_UserBasedFontInstallation.bat
Configuration: You can change the location of the Public Fonts -directory, if it pleases you.

Continue Reading

Show Workstation Name in Computer Icon and Start Menu (BAT)

Purpose: Show the Workstation name on Desktop and Start Menu (natively)

The case everyone is familiar with (more or less) is the case of getting a customer to tell the support personnel their computer name. This can be done with multiple different ways (tag the computer with stickers, link username and computer name in your management tool, or create something that helps the user to tell it). The way I’m going to demonstrate is suited for some cases: create something that helps the user to tell it. In this case it is going to be by renaming the “Computer” icon on the public desktop and forcing it to be shown there. This will also then rename the Start Menu “Computer”.

Requirements: SetACL.exe (http://helgeklein.com/setacl/) / included in the download
Usage: start “Configure” /wait IT_OSD_BAT_ShowWorkstationNameInMyComputer.bat
Debugging: The script must be ran as NT AUTHORITY/SYSTEM (ie. the installing force of SCCM).
Configuration: No need.
Continue Reading

Enable Remote Desktop from Command-line (BAT)

Purpose: Enable Remote Desktop on Workstations from Command-line

To gain access to the unsuspecting victims.. er.. customers, you can use the magnificent built-in tool of RDP! This even allows you to do your work hidden so the customer will not actually see what you are doing, how neat is that? (Well of course this is not neat in a situation where the customer wants to show you something but lets not go into that.) To enable RDP on a remote workstation, you can use the following registry change. Like many configuration options, this can be implemented through various ways. This script can be added to SCCM as an application and use the registry change as Detection Method. This way – if the setting is already as we want – SCCM will not do anything on the workstation.

Usage: start “Configure” /wait IT_OSD_BAT_EnableRemoteDesktop.bat

Continue Reading

Enable Remote Registry Service (BAT)

Purpose: Start the Remote Registry service during system startup

In corporate environments, administrative users and support personnel might need to be able to access the remote workstation registry. In these scenarios, the work can be done without disturbing the customer and then just informing the customer that the fix has been made. Unless this is set in the workstation image, you need to enable this afterwards. Luckily it can be done easily through SCCM application deployment. There are plenty alternative ways to do this (GPO, Login script, OS image, Packages, etc.). This method is just as straightforward as any of them and allows you to track its progress through the environment using the built-in tools of SCCM.

Usage: start “Configure” /wait IT_OSD_BAT_EnableRemoteDesktop.bat
Debugging: Occurs during next login. Should you need faster, start it instantly as well.
This can be done by running the following command: sc.exe start RemoteRegistry. The extra registry key is just for SCCM to be used as an application anchor (detection method).

Continue Reading