I got the powershell to run successfully this morning.  I had to make the site 
server's computer account a "Full Administrator" inside SCCM.  I'd seen that in 
passing on one page I was on last week, and at the time didn't think it 
mattered, but after thinking about Sherry's posts on the topic, thought I'd 
give it a try this morning.  The two powershell lines below, properly adjusted 
for collection id, now resets the PXE advert on machines in the collection for 
me.  So, I suspect it will work via a status filter rule now too.

So my status filter rule uses:
General Tab:
Source: Client
Component: (typed in, because it doesn't pre-exist in the list) Task Sequence 
Manager
Message ID: 11171
Property: Package ID
Property Value: <Package ID of the Task Sequence I want the script to run 
against> ABC0013C

Actions tab:
Run a program: C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe 
-executionpolicy bypass -file E:\Scripts\Set-CollectionClearLastPXE.ps1

And the only two lines in that script are:

$Collection = Get-WmiObject -Namespace root\sms\site_abc -Class SMS_Collection 
-Filter "CollectionID = 'ABC0013C'";
$Collection.ClearLastNBSAdvForCollection();

Todd



From: [email protected] [mailto:[email protected]] On 
Behalf Of Stuart Watret
Sent: Monday, March 3, 2014 10:10 AM
To: [email protected]
Subject: RE: [mssms] Clear pxe flags on collection


Well certainly run independantly that script works for me Trevor.



Though no joy when triggered (or not) by the status filter rule.......



Anyone know of a log that reports status filter rule actions, I'd like to see 
if it's trying to run the script.



The rule is pretty straight forward, mirroring what you see when a new asset is 
added to the collection:

[cid:[email protected]]









Stuart Watret

Offshore - IT Ltd

________________________________
From: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> on 
behalf of Trevor Sullivan <[email protected]<mailto:[email protected]>>
Sent: 28 February 2014 16:26
To: [email protected]<mailto:[email protected]>
Subject: RE: [mssms] Clear pxe flags on collection

Stuart,

I think you should be able to use the following:

$Collection = Get-WmiObject -Namespace root\sms\site_lab -Class SMS_Collection 
-Filter "CollectionID = 'SMS00001'";
$Collection.ClearLastNBSAdvForCollection();

Make sure to replace the "lab" with your site code, and the "SMS00001" with 
your collection ID. Let me know how this works.

http://msdn.microsoft.com/en-us/library/cc146058.aspx

Cheers,
Trevor Sullivan

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Stuart Watret
Sent: Friday, February 28, 2014 10:14 AM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] Clear pxe flags on collection


Been trying to do this for a couple of hours and can't find a working script.



Tried a VB example and the powershell stuff; having issues with both.



Whatever I use I want to trigger from a status filter rule.



Anyone have a working example?



Stuart Watret

Offshore - IT Ltd






Reply via email to