Managing UAC with PowerShell

User Account Control (UAC) is a security component that enables users to perform common tasks as non-administrators, and as administrators without having to switch users, log off, or use Run As. By separating user and administrator functions, UAC helps users move toward using standard user rights by default. UAC can be managed using the registry. … Read more

Remove Certificates using PowerShell

1. Process This article details the way to remove certificates using PowerShell. The Cmdlet used to delete certificates is Remove-Item   Let’s take for example the following certificate: SCOM-ECO.   To check if the certificate is present in the store of the machine:           Launch the PowerShell Console.       … Read more

Send Email with PowerShell

The following script allows to send an email in HTML using SMTP with PowerShell. The script does not prompt for credentials (the user account and its according password are set into the script itself). To avoid writing user account and password in the script, Get-Credentials can be used to prompt the user for username and password. … Read more

Starting Runbook with PowerShell

To start an orchestrator runbook with PowerShell, Microsoft provide a reliable script in its MSDN web site. https://msdn.microsoft.com/en-us/library/hh921685.aspx   But, as prerequisite, the script needs the GUIDs for runbook and runbook parameters. There are different ways to find these GUIDs. One of the easier is to use Excel, and more specifically the PowerPivot plugin. Thank … 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