Tag Archives: Vbs

Add or Modify a Task Sequence variable (VBS)

Purpose: You need to manipulate a Task Sequence variable during an OS Deployment

So you have gotten yourself this deep into OS Deployment, well good for you! You are most likely trying to create something fancy and this article can work as a foundation on your future work with fancy-OS-deployments. You can either manipulate user given Task Sequence variables or you can create your own Task Sequence variables along the OS Deployment as you see fit.

Continue Reading

Copy a predefined file to all local user profiles (VBS)

Purpose: You want to copy a predefined file to all local workstation user profiles with SCCM

You might find yourself in a situation where some of the applications have been installed in one way and the others in another way. Depending on the problem, you might just want to clean the table and reinstall the the applications with your definitions. If this is not possible or would not be cost efficient, you could use SCCM to check if “something” exists and alter the workstations where this something is missing. In this example this “something” is a missing configuration file needed in EVERY USER PROFILE of the workstation.

Usage: cscript.exe IT_APP_VBS_CopyFileToEveryUserProfile.vbs
Configuration: You need to insert your own PREDEFINED FILE and LOCATION.

Continue Reading

Copy a predefined file to a current user networked personal folder (VBS)

Purpose: You want to copy a predefined file to the currently logged on user personal network folder with SCCM

You might find yourself in a situation where some of the applications have been installed in one way and the others in another way. Depending on the problem, you might just want to clean the table and reinstall the the applications with your definitions. If this is not possible or would not be cost efficient, you could use SCCM to check if “something” exists and alter the workstations where this something is missing. In this example this “something” is a missing configuration file located in the personal network folder of an user.

Usage: cscript.exe IT_APP_VBS_CopyFileToNetworkedPersonalFolder.vbs
Configuration: You need to insert your own PREDEFINED FILE and LOCATION.

Continue Reading

Detect if Windows Service Exists (VBS)

Purpose: Return true if predefined Windows Service Exists, return false if it does not exist

You might find yourself in a situation where some of the applications have been installed in one way and the others in another way. Depending on the problem, you might just want to clean the table and reinstall the the applications with your definitions. If this is not possible or would not be cost efficient, you could use SCCM to check if “something” exists and alter the workstations where this something is missing. In this example this “something” is a missing Windows Service.

Usage: cscript.exe IT_APP_VBS_GetWindowServiceStatus WINDOWSSERVICENAME
Configuration: You need to insert your own WINDOWS SERVICE NAME as a parameter for the script.
Reference: http://themonitoringguy.com/scripts-code/monitoring-windows-services-vbscript/

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

Remove a known file from Current User desktop (VBS)

Purpose: Remove a predefined file from every actual user profile folder in a workstation.

In a scenario where you have delivered files to every or some user profiles of a workstation, you need to iterate through the C:\Users\Public\ -subfolders to reach your files. Of course this can be used as well against something that you have not delivered at all. These scenarios can be faulty application shortcuts directly in user desktop, user based configuration files in AppData -folders or similar.

Usage: cscript.exe IT_OSD_VBS_RemoveAFileFromEveryUserProfile.vbs (no parameters exist)
Configuration: You need to insert the file that you want to remove to strFolderPathLocal

Continue Reading

Replace a Setting in a text file (VBS)

Purpose: Replace a setting in a text file without sending the whole file (for example: INI-file).

You might have an application that includes a configuration file. This configuration file is deployed along with the application. As time passes, your users will have made their own changes through the application to this configuration file. When you need to update all of the configuration files yourself, you simply cannot replace the file. This would remove all the changes that your users have done. You will need to replace the single line in the file and leave everything else as it was.

Usage: cscript.exe IT_APP_VBS_ReplaceLineInATextFile.vbs (no parameters exist)
Configuration: You need to insert your own customization line.

Continue Reading

Compare Registry Values (VBS)

Purpose: You have two registry values, which you need to compare

This solution is not compatible as a SCCM application custom script detection method. It is meant to generally demonstrate how to compare registry values with VBS.

Usage: cscript.exe IT_OSD_VBS_CompareTwoRegistryValues.vbs (no parameters exist)
Configuration: You need to insert your own registry paths.

Continue Reading

Read from an Active Directory computer object attribute (VBS)

Purpose: You have information that you need to read from an AD object attribute

Now that you have an attribute full of exiting new information, you need to get it down for business! From SCCM point of view – this usually is an AD computer object attribute (which value could be, for example, the physical location of the computer or the year the computer has been purchased, etc.). Yes well im glad if you also had read my previous article “Write to an Active Directory computer object attribute (VBS). You should know then that I really did not bother to come up with anything original to this description, its just a copy paste! But the script below really does what the topic claims it to do. With the script you can read the attribute value and continue your adventure with it anyway you want!

Usage: cscript.exe IT_OSD_VBS_ReadComputerADAttribute.vbs (no parameters exist)
Debugging: You can uncomment the msgbox rows, to see what values you are receiving.
Configuration: You need to change the AD Attribute that you want to read.

Continue Reading