Tag Archives: Vbs

Write to an Active Directory computer object attribute (VBS)

Purpose: You have information that you need to write to an AD objects attribute

Fancy stuff: you are in a dire need to automate AD object attribute writing. Usually (from SCCM point of view) this object is a computer object, and the attribute contains some additional information about the computer that your corporation has requested. This additional information could be, for example, the physical location of the computer or some specific owner details. The script below allows you to write to the current computer AD object (because it is used usually in a task sequence). Happy writing!

Usage: cscript.exe IT_OSD_VBS_WriteToComputerObjectAttribute.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 write to

Continue Reading

Move a Computer to an Active Directory Organizational Unit (VBS)

Purpose: During a SCCM 2012 Computer Deployment, troubleshoot your AD permissions

Ok – before you start with all the “Hey dude, there is a built-in action to do this!” -talks, hear me out first. Remember all those SCCM Task Sequence changes you made? And then tried the Task Sequence out by installing an operating system? You noticed that you had problems getting a computer to move to the correct Active Directory (AD) Organisational Unit (OU)? Made some troubleshooting changes and then tried again? Here is where this script will come in handy! You do not need to run through the Task Sequence just to see if your computer will now actually move to the correct OU (because this can take an hour, right?). You could do a new Task Sequence, with only one action, just to test if your workstation moves around AD  – but lets not stress that delicate System Center product with this. Most of the time problems with handling workstations in AD through SCCM are about permissions.

Usage: cscript.exe IT_OSD_VBS_MoveComputerADOU.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 OU location to suit your own environment.

Continue Reading

Join a Computer to an Active Directory Security Group (VBS)

Purpose: During a SCCM 2012 Computer Deployment, join the current computer to an AD SG

So you have been given a task to automate installations, welcome. More importantly,  there are several (… OK, one is enough) actions that occur to the desktop if it would be a member of an Active Directory (AD) Security Group (SG).  There is no automatic GUI to do this in System Center 2012 Configuration Manager (even SCCM 2012 SP1 wont save you on this one). Therefore you must script it. My example is straightforward. First you must know the LDAP of the SG you want the computer to join.  If you are new to this, in this case LDAP is a fancy word for “AD PATH”.  An example of AD PATH to a SG:

Continue Reading

Create a Folder from an Environmental Variable (VBS)

Purpose: Create a folder, which name is received from an environmental variable.

You might need to create a folder (deliver a file, get the string, etc.) based on a custom environmental variable.  In my scenario, I had an installation done differently across the domain. The only way to deliver a file to the installation directory was to either check which folder exists in the workstation (and hope you found all the permutations) or use the environmental variable (that was same in each workstation). I chose the environmental variable. In this example, a usually existing environmental variable %WINDIR% (the location of the windows installation) is used.

Usage: cscript.exe IT_APP_VBS_CreateFolderFromEnvironmentalVariable (no parameters exist)

Configuration: You need to change the folder location and environmental variable to match.

Continue Reading

Create Shortcuts for the Current User defined by the Current User Input (VBS)

Purpose: Create a shortcut in the current user desktop and current user Start Menu, defined by user

In corporate environments, standard users rarely have permissions to edit shortcuts for a workstation for all the users. You might come up with a scenario where you need to give users permission to create shortcuts for an application. Most importantly, the shortcut actually needs parameters to work correctly. To reduce the amount of Help Desk calls, you can create a script that creates the shortcuts correctly for the current users by asking the parameter. The parameter can be a server, http-address, profile name, application environment, and so on. This script is extremely helpful in a situation where the System Administrator might not know what parameter each user is actually using or creating all the different scenarios for users might not be cost-efficient. This of course requires that the users know which environment they are using, or this will not work as intended.

Usage: cscript.exe IT_APP_VBS_CreateShortcutsFromUserInput (User Input Required)

Configuration: You need to change the configuration in “Configure the script” -part of the code.

Continue Reading

Create a Shortcut for All Users of a workstation (VBS)

Purpose: Create a Windows Shortcut in the Public Desktop and Public Start Menu.

Are you in need to create shortcuts for all the users of a workstation? Do you have some silly vendor provided application that just needs to have its shortcuts fixed? And most importantly – you need to do this OFTEN? Then scripting a shortcut template is the answer for you. With this code example, you can create your own shortcuts. You might not have the time to do it yourself, so you can use one I have created. Important fact is that by using this method the actual target does not need to exist by the time of the creation – the shortcuts are created anyway!

Usage: cscript.exe CreateShortcuts.vbs (no parameters exist)

Configuration: You need to change the configuration in “Configure the script” -part of the code.

Continue Reading