jfgray
asked on
Modify Service settings
Hello,
I have the following script
$Computers = gc "c:\Active_Computers.txt"
$colItems = get-wmiobject -class "Win32_Service" -namespace "root\CIMV2" `
-computername $Computers
foreach ($objItem in $colItems) {
Write-Host $Computers
write-host "Desktop Interact: " $objItem.DesktopInteract
Write-Host "Service Name :" $objItem.DisplayName
write-host
}
I would like to only tell me where the service named "Intel Local Scheduler Service" is set to DesktopInteract = true and if it is change it to false
I have the following script
$Computers = gc "c:\Active_Computers.txt"
$colItems = get-wmiobject -class "Win32_Service" -namespace "root\CIMV2" `
-computername $Computers
foreach ($objItem in $colItems) {
Write-Host $Computers
write-host "Desktop Interact: " $objItem.DesktopInteract
Write-Host "Service Name :" $objItem.DisplayName
write-host
}
I would like to only tell me where the service named "Intel Local Scheduler Service" is set to DesktopInteract = true and if it is change it to false
We might find that that option doesn't actually work. If you find that to be the case, pop back and we can call the Change method to modify it. It might just take a little experimentation to get there :)
Chris
ASKER
I can now filter for only that service and where objItem.DesktopInteract = True but it does not take the check mark out of "Allow service to interact with desktop"
ASKER
This is what I have so far
========================== ========== =
$Computers = gc "c:\Active_Computers.txt"
$colItems = get-wmiobject -class "Win32_Service" -namespace "root\CIMV2" `
-computername $Computers -Filter "DisplayName='Intel Local Scheduler Service' AND DesktopInteract=$True"
foreach ($objItem in $colItems ) {
Write-Host $objItem.SystemName
}
========================== ========== =
==========================
$Computers = gc "c:\Active_Computers.txt"
$colItems = get-wmiobject -class "Win32_Service" -namespace "root\CIMV2" `
-computername $Computers -Filter "DisplayName='Intel Local Scheduler Service' AND DesktopInteract=$True"
foreach ($objItem in $colItems ) {
Write-Host $objItem.SystemName
}
==========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You the MAN !
Filter the results first:
Open in new window
Make sure that returns what you need first please :)Then, if it does:
Open in new window
And if all that works, reinstate the loop:Open in new window
HTHChris