Tuesday, February 16, 2016

Quest AD Powershell cmdlets



https://support.software.dell.com/download-install-detail/5024645

Run this command to make the cmdlets available in Powershell ISE

import-module -name "C:\Program Files\Quest Software\Management Shell for AD\ActiveRolesManagementShell" -Verbose

Thursday, February 4, 2016

Check a machine is valid.

This was part of a solution to check that a PC was a valid PC to launch on.  I've posted it here to illustrate several techniques including deleting files, generating files, evaluating variables, block coments and querying machine information using WMI.

-computername <machname> can direct a get-wmiobject query to a remote machine


#reset
Remove-Item ".\Application Data\Folder\PCValid.txt"
#read current PC name
$machname = get-wmiobject -namespace root\CIMV2 -Class Win32_ComputerSystem | select -expand name
#read AssignedPC.txt
$AssignedPC = get-content ".\Application Data\Folder\AssignedPC.txt"
# create a file if the values match.
if ($machname -eq $AssignedPC) {out-file ".\Application Data\Folder\PCValid.txt"}

<#
This is a block comment
#>