VBScript Usual Commands

Here is a memento of several useful commands in VBScript (common declarations, check files, folders and registry, create or delete files and folders, copy files and folders).   TechNet: https://technet.microsoft.com/en-us/library/ee198844.aspx W3Schools: http://www.w3schools.com/asp/vbscript_ref_functions.asp   Date/Time, Conversion, Format, Math, Array, String… This article will be updated progressively.   1. Common Declarations Set fso = CreateObject(“scripting.FileSystemObject”) Set WshShell … Read more

Managing Active Directory with VBS

The following scripts (VBS) allows play with Active Directory. It details a way to: Create an Organizational Unit Create a Group in an Organizational Unit Rename a Group List all Groups in an Organizational Unit Create a User in an Organization Unit and assign it to a Group List all members in a Group Delete … Read more

PowerShell Date Time

To play with Date and Time with PowerShell, the main Cmdlet to use is Get-Date. TechNet: https://technet.microsoft.com/en-us/library/hh849887.aspx The Get-Date cmdlet gets a DateTime object that represents the current date or a date that you specify. It can format the date and time in several Windows and UNIX formats. You can use Get-Date to generate a … Read more

Remove “Users” Group from ACL

This script allows to remove the “Users” Group from the Access Control List (ACL) of a file or folder. First, the NTFS rights inheritance is removed, then the “Users” group is removed from ACL. To play with ACL, the Cmdlet to use is the following: Get-Acl TechNet: https://technet.microsoft.com/fr-fr/library/hh849802.aspx The Get-Acl cmdlet gets objects that represent … Read more

Check Hotfix with PowerShell

This script allows to check if a KB (Hotfix) is installed on a machine. The Cmdlet to use is Get-Hotfix. The Get-Hotfix cmdlet gets hotfixes (also called updates) that have been installed on either the local computer (or on specified remote computers) by Windows Update, Microsoft Update, or Windows Server Update Services; the cmdlet also … Read more

PowerShell Usual Commands

Here is a memento of several useful commands in PowerShell (check files, folders and registry, create or delete files and folders, run executables with or without arguments, displaying MsgBox…). Here is the TechNet listing the standard CmdLets: https://technet.microsoft.com/en-us/library/hh848794.aspx There are only few commands for the time being, but this article will be updated progressively. . Check … Read more

Send Variable to SCCM Task Sequence

In this example, we launch the command cctk.exe –tpm If the result is equal to “tpm=on”, $TPMvalue variable is set to “on”, else $TPMvalue variable is set to “off” tpm variable is send to the task sequence with the value of $TPMvalue To retrieve the information in the Task Sequence, use the variable “tpm” (value … Read more

PowerShell and Strings

Here is a memento of several ways to play with strings in PowerShell. Insert Double Quote and ASCII codes Return a specified number of characters   Insert Double Quotes and ASCII Codes To insert double quotes in a string, the following ASCII code can be used: [char]34 ASCII codes can be inserted like follow: $([char]34) … Read more

PADT – Registry

PowerShell Application Deployment Toolkit is a tool very powerful to manage the registry: Adding, modifying, deleting registry keys and registry values Adding HKEY CURRENT USER registry entries for all existing user profiles + default user, to avoid Active Setup Modifying the value of environment variables (for example the PATH environment variable)   1. Import REG … Read more