WindowsServer

Powershell – Change computer description

To continue in Powershell posts, we will see how to change the local description of the server. Not in Active Directory attribute but on the computer itself.

System Description

The local description is set is the WMI of the server. In the class Win32_OperatingSystem. To change it, we need to get the objects, set the new content and save the modification.

$OSWMI=Get-WmiObject -class Win32_OperatingSystem
$OSWMI.Description="My Server"
$OSWMI.put()

Remote

It is possible to modify the description on a remote computer, however, we need to adapt the script if the string is store in a variable.

With the Invoke-Command we add the parameter –ArgumentList, so that our variable content will be available on the execution on the remote host.

$myDescription="My Server"
Invoke-Command -ComputerName $lServerName -ScriptBlock {$OSWMI=Get-WmiObject -class Win32_OperatingSystem;$OSWMI.Description=$args[0];$OSWMI.put() } -ArgumentList($myDescription)

More

You can get more information about Win32_OperatingSystem class here

Share
SCCM

SCCM 2012 – Detection Method for Update

With Configuration Manager 2012, you have a new feature to deploy your software: Application. To use Application, you need to add a Detection Method. This detection method is based on several criterias and it will check if the application is already installed on the computer.

SCCM included three built-in detections:

  • File/Folder: check if a file exists on the drive. Date modified, Version and Size can be used.
  • Registry: Check if a registry key exists.
  • Windows Installer: Check if a product code is installed.

Moreover, you can user another detection:

  • Custom script: write and execute you own script to detect the application. You can use Powershell, VBScript and JScript.

However, when you want to install a software update using Application, there is no built-in function to detect if the update is installed. You have to use a custom script.
Continue reading

Share