I watched a video on how to remove Silverlight, but I figure it may be helpful to post this with just the command line (no source necessary):
wmic product where caption='Microsoft Silverlight' call uninstall
I watched a video on how to remove Silverlight, but I figure it may be helpful to post this with just the command line (no source necessary):
wmic product where caption='Microsoft Silverlight' call uninstall
I received a request to find workstations that were using certain user names in ODBC data sources. To find them, I created a configuration baseline with the following script as the compliance setting. (I didn’t write the script – when I explained to the requester how it could be done, he was kind enough to write it for me.)
$user_id_list = @("STARSQLX", "CAINDBS2", "PTSBSTAR") $resulted_ds_list = @() $odbc_ds_list = Get-ChildItem -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ -Name $key_path = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\" for($i=0; $i -lt $odbc_ds_list.Length; $i++) { if($odbc_ds_list[$i] -ne "ODBC Data Sources") { $path = $key_path + $odbc_ds_list[$i] $uid = (Get-ItemProperty -Path $path -Name "UID").UID for($j=0; $j -lt $user_id_list.Length; $j++) { if ($uid -eq $user_id_list[$j]) { $resulted_ds_list += $odbc_ds_list[$i] } } } } #Write-Host $resulted_ds_list if ($resulted_ds_list.count -eq 0) {write-host $false} else {write-host $true}
Using this, but just reposting the command line part, and putting in some comments on what the parameters do.
rem Take ownership: rem /a Gives ownership to the administrators group instead of the current user. rem /r recursive rem /d y Default answer used when the current user does not have the "list folder" rem permission on a directory. "Y" to take ownership. takeown.exe /f "C:\Windows.old" /a /r /d y rem Granting full control permission to the built in Administrators group rem Asterisk used to denote Administrators group's SID (S-1-5-32-544) is used rem /T indicates that this operation is performed on all matching files rem and directories below the directories specified in the name. rem /C indicates that this operation will continue on all file errors. rem /Q indicates that icacls should suppress success messages. icacls "C:\Windows.old" /grant *S-1-5-32-544:f /t /c /q rd /s /q "C:\Windows.old"
Usage: powershell.exe .\Force-DCMEvaluation.ps1 <COMPUTERNAME>
Force-DCMEvaluation.ps1:
param([Parameter(Mandatory=$true)][string] $ComputerName) $Baselines = Get-WmiObject -ComputerName $ComputerName -Namespace root\ccm\dcm -Class SMS_DesiredConfiguration $Baselines | % {([wmiclass]"\\$ComputerName\root\ccm\dcm:SMS_DesiredConfiguration").TriggerEvaluation($_.Name, $_.Version)}