Creating and using Password Hashes and Secure Strings with Powershell

This is how you can generate a Secure String with powershell and use it in your scripts

secureString = Read-Host -AsSecureString
ConvertFrom-SecureString $secureString | out-file c:\temp\encrypted.txt
$newString = gc C:\temp\encrypted.txt | ConvertTo-SecureString

Load the Secure string from file and use it in your script:

$securePassword = Get-Content c:\temp\encrypted.txt | ConvertTo-SecureString

How to uninstall with msiexec using product id guid

You can find the product code by perusing the registry from this base key: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall . Press F3 and search for your product name. (If it’s a 32-bit installer on a 64-bit machine, it might be under HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall instead).

Finally, you can find the product code also by using PowerShell:

get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name

when you found the Guid ID you can use msiexec to uninstall the application

msiexec /x {A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8}

 

Unlocking ConfigMgr Objects

here is what you need to do when you get the error blow in SCCM2012 console:
“Cannot edit the object, which is in use by ‘’ at Site ‘’.”

This happened as the result of the ConfigMgr console crashing while he had the object open.

To resolve this issue connect with sql management studio to the SQL server where the database is running and then execute the code below:

 select * from SEDO_LockState where LockStateID <> 0

The query above will get you a list of possible locks on the dB, with the code below you can remove the lock:

DELETE from SEDO_LockState where LockID = ‘<LockID of the record identified in the previous query>’

Once the record is removed, you should be able to modify the object.

PowerShell – How to find details of Operating System

There were several instances where I had to find details of the operating system using PowerShell. Here, I am providing several PowerShell snippets that return various details of the Operating System.

Name of the Operating System

(Get-WmiObject Win32_OperatingSystem).Name

Is Operating System 32-bit or 64-bit

(Get-WmiObject Win32_OperatingSystem).OSArchitecture

Name of the Machine

(Get-WmiObject Win32_OperatingSystem).CSName

There are many more properties of the Operating System that are exposed. To obtain more details, run the following

Get-WmiObject Win32_OperatingSystem | Get-Member

 

SCCM 2012 client fails to install Windows 10 Build 10049

When testing the latest Build of Windows 10 I got an error installing the Configuration Manager 2012 R2 client, it fails installing the Windows Update agent with the following error in the CCMSetup.log file.

“File ‘C:WINDOWSccmsetupWindowsUpdateAgent30-x64.exe’ returned failure exit code 775. Fail the installation.”

Continue reading SCCM 2012 client fails to install Windows 10 Build 10049