| Author | Messages | |
jason
Posts:21
 | | 03/24/2010 5:10 PM |
| Hi all, I've done a few GPO-related Powershell tasks using the SDM GPMC powershell cmdlets <http://www.sdmsoftware.com/freeware.php> (Thanks Darren!) and I'm running into an issue with my current task and I'm hoping someone has a suggestion to fix it or another way to solve it...
I'm attempting to get a listing of all GPOs that start with the word "finance" so I can add a security right to it. Here's what I'm trying: *get-SDMgpo -name "finance*" * but that fails with the error: Get-SDMgpo : Unable to find selected GPO(s) At line:1 char:11 + get-sdmgpo <<<< -name "finance*"
It seems the cmdlet doesn't like the wildcard in the name. So, OK, I try to get around it with: *get-SDMgpo -name * | where-object {$_.name -eq "finance*"}* but that eventually fails with: Get-SDMgpo : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) At line:1 char:11 + get-sdmgpo <<<< -name * | where-object {$_.name -eq "finance*"}
It appears it's an issue with the number of results being returned that is causing the HRESULT error because I get the same error when running: *get-SDMgpo * *
That returns a bunch of GPOs (we have 1000+ GPOs in our environment) but eventually gives the same HRESULT error.
I'm thinking I'll have to get the list of GPOs that match my criteria (e.g. name contains "finance") in some other way and import that to the add-SDMgposecurity cmdlet to meet my goal. Ideas or suggestions?
Thanks, Jason
--
Jason Halladay
| | | |
| JamieNelson
Posts:166
 | | 03/24/2010 6:36 PM |
| I don't think the cmdlet supports wildcards in the name. If you read the help for it, it expects one of the following:
* A "*" to list all GPOs
* The "friendly name" of a GPO
* The GPO GUID (if using the -GPOID parameter)
I think you would need to use the Where-Object approach to filter, and you'll also want to use the -like or -match operators for doing a wildcard or regex filter. If you use -eq that is looking for a literal match and won't work.
Hope that helps.
Jamie Nelson | Sr. Administrator | BI&T Infrastructure-Intel | Devon Energy Corporation | Work: ' 405.552.8054 | Mobile: ' 405.248.7963 | http://www.dvn.com <http://www.dvn.com/>
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Jason B. Halladay Sent: Wednesday, March 24, 2010 12:06 PM To: xxxxxxxxxxxxxxxx Subject: [gptalk] SDM GPMC posh cmdlets
Hi all, I've done a few GPO-related Powershell tasks using the SDM GPMC powershell cmdlets <http://www.sdmsoftware.com/freeware.php> (Thanks Darren!) and I'm running into an issue with my current task and I'm hoping someone has a suggestion to fix it or another way to solve it...
I'm attempting to get a listing of all GPOs that start with the word "finance" so I can add a security right to it. Here's what I'm trying: get-SDMgpo -name "finance*" but that fails with the error: Get-SDMgpo : Unable to find selected GPO(s) At line:1 char:11 + get-sdmgpo <<<< -name "finance*"
It seems the cmdlet doesn't like the wildcard in the name. So, OK, I try to get around it with: get-SDMgpo -name * | where-object {$_.name -eq "finance*"} but that eventually fails with: Get-SDMgpo : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) At line:1 char:11 + get-sdmgpo <<<< -name * | where-object {$_.name -eq "finance*"}
It appears it's an issue with the number of results being returned that is causing the HRESULT error because I get the same error when running: get-SDMgpo *
That returns a bunch of GPOs (we have 1000+ GPOs in our environment) but eventually gives the same HRESULT error.
I'm thinking I'll have to get the list of GPOs that match my criteria (e.g. name contains "finance") in some other way and import that to the add-SDMgposecurity cmdlet to meet my goal. Ideas or suggestions?
Thanks, Jason
--
Jason Halladay
Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of all or any portion of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system.
| | | |
| dmarelia
Posts:394
 | | 03/24/2010 6:36 PM |
| Jamie's right about the wildcard support (or lack thereof) in the current cmdlets. It is something I can add, but Jamie's approach is probably quicker. What does sound like a significant issue is the error you're getting when doing a get-sdmgpo *. I have seen this come up occasionally when there was a corrupted GPO in an environment. There shouldn't be any limit on the number of GPOs we can enumerate. Jason, does it always crash on the same GPO?
Darren
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Nelson, Jamie Sent: Wednesday, March 24, 2010 10:56 AM To: xxxxxxxxxxxxxxxx Subject: RE: [gptalk] SDM GPMC posh cmdlets
I don't think the cmdlet supports wildcards in the name. If you read the help for it, it expects one of the following:
* A "*" to list all GPOs
* The "friendly name" of a GPO
* The GPO GUID (if using the -GPOID parameter)
I think you would need to use the Where-Object approach to filter, and you'll also want to use the -like or -match operators for doing a wildcard or regex filter. If you use -eq that is looking for a literal match and won't work.
Hope that helps.
Jamie Nelson | Sr. Administrator | BI&T Infrastructure-Intel | Devon Energy Corporation | Work: ' 405.552.8054 | Mobile: ' 405.248.7963 | http://www.dvn.com<http://www.dvn.com/>
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Jason B. Halladay Sent: Wednesday, March 24, 2010 12:06 PM To: xxxxxxxxxxxxxxxx Subject: [gptalk] SDM GPMC posh cmdlets
Hi all, I've done a few GPO-related Powershell tasks using the SDM GPMC powershell cmdlets<http://www.sdmsoftware.com/freeware.php> (Thanks Darren!) and I'm running into an issue with my current task and I'm hoping someone has a suggestion to fix it or another way to solve it...
I'm attempting to get a listing of all GPOs that start with the word "finance" so I can add a security right to it. Here's what I'm trying: get-SDMgpo -name "finance*" but that fails with the error: Get-SDMgpo : Unable to find selected GPO(s) At line:1 char:11 + get-sdmgpo <<<< -name "finance*"
It seems the cmdlet doesn't like the wildcard in the name. So, OK, I try to get around it with: get-SDMgpo -name * | where-object {$_.name -eq "finance*"} but that eventually fails with: Get-SDMgpo : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) At line:1 char:11 + get-sdmgpo <<<< -name * | where-object {$_.name -eq "finance*"}
It appears it's an issue with the number of results being returned that is causing the HRESULT error because I get the same error when running: get-SDMgpo *
That returns a bunch of GPOs (we have 1000+ GPOs in our environment) but eventually gives the same HRESULT error.
I'm thinking I'll have to get the list of GPOs that match my criteria (e.g. name contains "finance") in some other way and import that to the add-SDMgposecurity cmdlet to meet my goal. Ideas or suggestions?
Thanks, Jason
--
Jason Halladay
________________________________
Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of all or any portion of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system.
| | | |
| davesharples
Posts:55
 | | 03/24/2010 6:44 PM |
| You will also get that error if you don't have permission to read the gpo
On 24 Mar 2010, at 18:09, "Darren Mar-Elia" <xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx>> wrote:
Jamie’s right about the wildcard support (or lack thereof) in the current cmdlets. It is something I can add, but Jamie’s approach is probably quicker. What does sound like a significant issue is the error you’re getting when doing a get-sdmgpo *. I have seen this come up occasionally when there was a corrupted GPO in an environment. There shouldn’t be any limit on the number of GPOs we can enumerate. Jason, does it always crash on the same GPO?
Darren
From: xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Nelson, Jamie Sent: Wednesday, March 24, 2010 10:56 AM To: <mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx> Subject: RE: [gptalk] SDM GPMC posh cmdlets
I don’t think the cmdlet supports wildcards in the name. If you read the help for it, it expects one of the following:
· A “*” to list all GPOs
· The “friendly name” of a GPO
· The GPO GUID (if using the –GPOID parameter)
I think you would need to use the Where-Object approach to filter, and you’ll also want to use the –like or –match operators for doing a wildcard or regex filter. If you use -eq that is looking for a literal match and won’t work.
Hope that helps.
Jamie Nelson | Sr. Administrator | BI&T Infrastructure-Intel | Devon Energy Corporation | Work: ' 405.552.8054 | Mobile: ' 405.248.7963 | <http://www.dvn.com/> http://www.dvn.com
From: xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Jason B. Halladay Sent: Wednesday, March 24, 2010 12:06 PM To: <mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx> Subject: [gptalk] SDM GPMC posh cmdlets
Hi all, I've done a few GPO-related Powershell tasks using the SDM GPMC powershell cmdlets<http://www.sdmsoftware.com/freeware.php> (Thanks Darren!) and I'm running into an issue with my current task and I'm hoping someone has a suggestion to fix it or another way to solve it...
I'm attempting to get a listing of all GPOs that start with the word "finance" so I can add a security right to it. Here's what I'm trying: get-SDMgpo -name "finance*" but that fails with the error: Get-SDMgpo : Unable to find selected GPO(s) At line:1 char:11 + get-sdmgpo <<<< -name "finance*"
It seems the cmdlet doesn't like the wildcard in the name. So, OK, I try to get around it with: get-SDMgpo -name * | where-object {$_.name -eq "finance*"} but that eventually fails with: Get-SDMgpo : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) At line:1 char:11 + get-sdmgpo <<<< -name * | where-object {$_.name -eq "finance*"}
It appears it's an issue with the number of results being returned that is causing the HRESULT error because I get the same error when running: get-SDMgpo *
That returns a bunch of GPOs (we have 1000+ GPOs in our environment) but eventually gives the same HRESULT error.
I'm thinking I'll have to get the list of GPOs that match my criteria (e.g. name contains "finance") in some other way and import that to the add-SDMgposecurity cmdlet to meet my goal. Ideas or suggestions?
Thanks, Jason
--
Jason Halladay
________________________________
Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of all or any portion of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system.
| | | |
| jason
Posts:21
 | | 03/24/2010 7:37 PM |
| Good points you guys, thanks. Jamie, good call on the -like operator. I knew better. Sheesh. But, as you've noted, the problem is with the enumeration of the GPOs. It does appear to be crashing on the same GPO when I run the command to get all GPOs repeatedly. As best I can tell the GPOs are being enumerated by creation date so perhaps I can track down the corrupt GPO in some way using that information. I'm running the command as a domain administrator.
Thank you for the input, Jason
On 3/24/10 12:30 PM, Dave Sharples wrote: > You will also get that error if you don't have permission to read the gpo > > On 24 Mar 2010, at 18:09, "Darren Mar-Elia" <xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx>> wrote: > > Jamie’s right about the wildcard support (or lack thereof) in the current cmdlets. It is something I can add, but Jamie’s approach is probably quicker. What does sound like a significant issue is the error you’re getting when doing a get-sdmgpo *. I have seen this come up occasionally when there was a corrupted GPO in an environment. There shouldn’t be any limit on the number of GPOs we can enumerate. Jason, does it always crash on the same GPO? > > Darren > > From: xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Nelson, Jamie > Sent: Wednesday, March 24, 2010 10:56 AM > To: <mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx> > Subject: RE: [gptalk] SDM GPMC posh cmdlets > > I don’t think the cmdlet supports wildcards in the name. If you read the help for it, it expects one of the following: > > > · A “*” to list all GPOs > > · The “friendly name” of a GPO > > · The GPO GUID (if using the –GPOID parameter) > > I think you would need to use the Where-Object approach to filter, and you’ll also want to use the –like or –match operators for doing a wildcard or regex filter. If you use -eq that is looking for a literal match and won’t work. > > Hope that helps. > > Jamie Nelson | Sr. Administrator | BI&T Infrastructure-Intel | Devon Energy Corporation | Work: ' 405.552.8054 | Mobile: ' 405.248.7963 | <http://www.dvn.com/> http://www.dvn.com > > From: xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Jason B. Halladay > Sent: Wednesday, March 24, 2010 12:06 PM > To: <mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx> > Subject: [gptalk] SDM GPMC posh cmdlets > > Hi all, > I've done a few GPO-related Powershell tasks using the SDM GPMC powershell cmdlets<http://www.sdmsoftware.com/freeware.php> (Thanks Darren!) and I'm running into an issue with my current task and I'm hoping someone has a suggestion to fix it or another way to solve it... > > I'm attempting to get a listing of all GPOs that start with the word "finance" so I can add a security right to it. Here's what I'm trying: > get-SDMgpo -name "finance*" > but that fails with the error: > Get-SDMgpo : Unable to find selected GPO(s) > At line:1 char:11 > + get-sdmgpo <<<< -name "finance*" > > It seems the cmdlet doesn't like the wildcard in the name. So, OK, I try to get around it with: > get-SDMgpo -name * | where-object {$_.name -eq "finance*"} > but that eventually fails with: > Get-SDMgpo : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) > At line:1 char:11 > + get-sdmgpo <<<< -name * | where-object {$_.name -eq "finance*"} > > It appears it's an issue with the number of results being returned that is causing the HRESULT error because I get the same error when running: > get-SDMgpo * > > That returns a bunch of GPOs (we have 1000+ GPOs in our environment) but eventually gives the same HRESULT error. > > I'm thinking I'll have to get the list of GPOs that match my criteria (e.g. name contains "finance") in some other way and import that to the add-SDMgposecurity cmdlet to meet my goal. Ideas or suggestions? > > Thanks, > Jason > > -- > > Jason Halladay > > ________________________________ > > Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of all or any portion of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system. >
--
Jason Halladay
Los Alamos National Laboratory
NIE-2 Network Services Team
xxxxxxxxxxxxxxxx
Phone: 505-667-1261
Pager: 505-104-5987
| | | |
| dmarelia
Posts:394
 | | 03/24/2010 7:45 PM |
| Jason- Does the enumeration halt completely after the error or does it continue?
Thanks,
Darren
From: xxxxxxxxxxxxxxxx [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Jason B. Halladay Sent: Wednesday, March 24, 2010 12:04 PM To: xxxxxxxxxxxxxxxx Subject: Re: [gptalk] SDM GPMC posh cmdlets
Good points you guys, thanks. Jamie, good call on the -like operator. I knew better. Sheesh. But, as you've noted, the problem is with the enumeration of the GPOs. It does appear to be crashing on the same GPO when I run the command to get all GPOs repeatedly. As best I can tell the GPOs are being enumerated by creation date so perhaps I can track down the corrupt GPO in some way using that information. I'm running the command as a domain administrator.
Thank you for the input, Jason
On 3/24/10 12:30 PM, Dave Sharples wrote:
You will also get that error if you don't have permission to read the gpo
On 24 Mar 2010, at 18:09, "Darren Mar-Elia" <xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx>> wrote:
Jamie’s right about the wildcard support (or lack thereof) in the current cmdlets. It is something I can add, but Jamie’s approach is probably quicker. What does sound like a significant issue is the error you’re getting when doing a get-sdmgpo *. I have seen this come up occasionally when there was a corrupted GPO in an environment. There shouldn’t be any limit on the number of GPOs we can enumerate. Jason, does it always crash on the same GPO?
Darren
From: xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Nelson, Jamie
Sent: Wednesday, March 24, 2010 10:56 AM
To: <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx>
Subject: RE: [gptalk] SDM GPMC posh cmdlets
I don’t think the cmdlet supports wildcards in the name. If you read the help for it, it expects one of the following:
· A “*” to list all GPOs
· The “friendly name” of a GPO
· The GPO GUID (if using the –GPOID parameter)
I think you would need to use the Where-Object approach to filter, and you’ll also want to use the –like or –match operators for doing a wildcard or regex filter. If you use -eq that is looking for a literal match and won’t work.
Hope that helps.
Jamie Nelson | Sr. Administrator | BI&T Infrastructure-Intel | Devon Energy Corporation | Work: ' 405.552.8054 | Mobile: ' 405.248.7963 | <http://www.dvn.com/><http://www.dvn.com/> http://www.dvn.com
From: xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Jason B. Halladay
Sent: Wednesday, March 24, 2010 12:06 PM
To: <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx>
Subject: [gptalk] SDM GPMC posh cmdlets
Hi all,
I've done a few GPO-related Powershell tasks using the SDM GPMC powershell cmdlets<http://www.sdmsoftware.com/freeware.php><http://www.sdmsoftware.com/freeware.php> (Thanks Darren!) and I'm running into an issue with my current task and I'm hoping someone has a suggestion to fix it or another way to solve it...
I'm attempting to get a listing of all GPOs that start with the word "finance" so I can add a security right to it. Here's what I'm trying:
get-SDMgpo -name "finance*"
but that fails with the error:
Get-SDMgpo : Unable to find selected GPO(s)
At line:1 char:11
+ get-sdmgpo <<<< -name "finance*"
It seems the cmdlet doesn't like the wildcard in the name. So, OK, I try to get around it with:
get-SDMgpo -name * | where-object {$_.name -eq "finance*"}
but that eventually fails with:
Get-SDMgpo : The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
At line:1 char:11
+ get-sdmgpo <<<< -name * | where-object {$_.name -eq "finance*"}
It appears it's an issue with the number of results being returned that is causing the HRESULT error because I get the same error when running:
get-SDMgpo *
That returns a bunch of GPOs (we have 1000+ GPOs in our environment) but eventually gives the same HRESULT error.
I'm thinking I'll have to get the list of GPOs that match my criteria (e.g. name contains "finance") in some other way and import that to the add-SDMgposecurity cmdlet to meet my goal. Ideas or suggestions?
Thanks,
Jason
--
Jason Halladay
________________________________
Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of all or any portion of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system.
--
Jason Halladay
Los Alamos National Laboratory
NIE-2 Network Services Team
xxxxxxxxxxxxxxxx<mailto:xxxxxxxxxxxxxxxx>
Phone: 505-667-1261
Pager: 505-104-5987
| | | |
| jason
Posts:21
 | | 03/24/2010 8:08 PM |
| Hello Darren, It halts completely. I tried using the common parameter -erroraction silentlycontinue but the command still halts. And now, as I just ran the command again, it halted after a different GPO. Hmm... I'm investigating the corrupt GPO idea more now.
Thanks, Jason
On 3/24/10 1:11 PM, Darren Mar-Elia wrote: > > Jason- > > Does the enumeration halt completely after the error or does it continue? > > > > Thanks, > > > Darren > > > > *From:* xxxxxxxxxxxxxxxx > [mailto:xxxxxxxxxxxxxxxx] *On Behalf Of *Jason B. Halladay > *Sent:* Wednesday, March 24, 2010 12:04 PM > *To:* xxxxxxxxxxxxxxxx > *Subject:* Re: [gptalk] SDM GPMC posh cmdlets > > > > Good points you guys, thanks. Jamie, good call on the -like > operator. I knew better. Sheesh. But, as you've noted, the problem > is with the enumeration of the GPOs. > It does appear to be crashing on the same GPO when I run the command > to get all GPOs repeatedly. As best I can tell the GPOs are being > enumerated by creation date so perhaps I can track down the corrupt > GPO in some way using that information. > I'm running the command as a domain administrator. > > Thank you for the input, > Jason > > On 3/24/10 12:30 PM, Dave Sharples wrote: > > You will also get that error if you don't have permission to read the gpo > > On 24 Mar 2010, at 18:09, "Darren Mar-Elia" <xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx>> wrote: > > Jamie’s right about the wildcard support (or lack thereof) in the current cmdlets. It is something I can add, but Jamie’s approach is probably quicker. What does sound like a significant issue is the error you’re getting when doing a get-sdmgpo *. I have seen this come up occasionally when there was a corrupted GPO in an environment. There shouldn’t be any limit on the number of GPOs we can enumerate. Jason, does it always crash on the same GPO? > > Darren > > From: xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Nelson, Jamie > Sent: Wednesday, March 24, 2010 10:56 AM > To: <mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> > Subject: RE: [gptalk] SDM GPMC posh cmdlets > > I don’t think the cmdlet supports wildcards in the name. If you read the help for it, it expects one of the following: > > > · A “*” to list all GPOs > > · The “friendly name” of a GPO > > · The GPO GUID (if using the –GPOID parameter) > > I think you would need to use the Where-Object approach to filter, and you’ll also want to use the –like or –match operators for doing a wildcard or regex filter. If you use -eq that is looking for a literal match and won’t work. > > Hope that helps. > > Jamie Nelson | Sr. Administrator | BI&T Infrastructure-Intel | Devon Energy Corporation | Work: ' 405.552.8054 | Mobile: ' 405.248.7963 | <http://www.dvn.com/> http://www.dvn.com > > From: xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Jason B. Halladay > Sent: Wednesday, March 24, 2010 12:06 PM > To: <mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> > Subject: [gptalk] SDM GPMC posh cmdlets > > Hi all, > I've done a few GPO-related Powershell tasks using the SDM GPMC powershell cmdlets<http://www.sdmsoftware.com/freeware.php> (Thanks Darren!) and I'm running into an issue with my current task and I'm hoping someone has a suggestion to fix it or another way to solve it... > > I'm attempting to get a listing of all GPOs that start with the word "finance" so I can add a security right to it. Here's what I'm trying: > get-SDMgpo -name "finance*" > but that fails with the error: > Get-SDMgpo : Unable to find selected GPO(s) > At line:1 char:11 > + get-sdmgpo <<<< -name "finance*" > > It seems the cmdlet doesn't like the wildcard in the name. So, OK, I try to get around it with: > get-SDMgpo -name * | where-object {$_.name -eq "finance*"} > but that eventually fails with: > Get-SDMgpo : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) > At line:1 char:11 > + get-sdmgpo <<<< -name * | where-object {$_.name -eq "finance*"} > > It appears it's an issue with the number of results being returned that is causing the HRESULT error because I get the same error when running: > get-SDMgpo * > > That returns a bunch of GPOs (we have 1000+ GPOs in our environment) but eventually gives the same HRESULT error. > > I'm thinking I'll have to get the list of GPOs that match my criteria (e.g. name contains "finance") in some other way and import that to the add-SDMgposecurity cmdlet to meet my goal. Ideas or suggestions? > > Thanks, > Jason > > -- > > Jason Halladay > > ________________________________ > > Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of all or any portion of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system. > > > > > -- > > Jason Halladay > > Los Alamos National Laboratory > > >
--
Jason Halladay
Los Alamos National Laboratory
| | | |
| jason
Posts:21
 | | 03/24/2010 9:20 PM |
| Hello again, This is for those that may be interested in doing what I'm doing here (getting a list of GPOs that meet a certain naming criteria and then using SDM software's GPMC cmdlets to add a security permission to those GPOs). I gave up, temporarily, on trying to identify the issue with using get-SDMgpo to enumerate all the GPOs with a certain string in the name and instead used another method. (I'm sure the issue is with something in my environment rather than with the cmdlet). I used the search feature in the GPMC to get a list of all the GPOs containing the word "finance" in the GPO name. In that search feature in the GPMC one can save the results to a csv file so I did that. The CSV file contained the GPO name and GPO GUID so I called those columns "name" and "gpoid" in the saved CSV file.
Then the powershell script: $gpos = Import-Csv d:\finance.csv
foreach ($gpo in $gpos){ $gponame = $gpo.name Add-SDMgpoSecurity -Name $gponame -Trustee "YOURDOMAIN\GROUPNAME" -PermEditSecurityAndDelete }
Thanks for the help, Jason
On 3/24/10 1:25 PM, Jason B. Halladay wrote: > Hello Darren, > It halts completely. I tried using the common parameter -erroraction > silentlycontinue but the command still halts. And now, as I just ran > the command again, it halted after a different GPO. Hmm... I'm > investigating the corrupt GPO idea more now. > > Thanks, > Jason > > On 3/24/10 1:11 PM, Darren Mar-Elia wrote: >> >> Jason- >> >> Does the enumeration halt completely after the error or does it continue? >> >> >> >> Thanks, >> >> >> Darren >> >> >> >> *From:* xxxxxxxxxxxxxxxx >> [mailto:xxxxxxxxxxxxxxxx] *On Behalf Of *Jason B. Halladay >> *Sent:* Wednesday, March 24, 2010 12:04 PM >> *To:* xxxxxxxxxxxxxxxx >> *Subject:* Re: [gptalk] SDM GPMC posh cmdlets >> >> >> >> Good points you guys, thanks. Jamie, good call on the -like >> operator. I knew better. Sheesh. But, as you've noted, the problem >> is with the enumeration of the GPOs. >> It does appear to be crashing on the same GPO when I run the command >> to get all GPOs repeatedly. As best I can tell the GPOs are being >> enumerated by creation date so perhaps I can track down the corrupt >> GPO in some way using that information. >> I'm running the command as a domain administrator. >> >> Thank you for the input, >> Jason >> >> On 3/24/10 12:30 PM, Dave Sharples wrote: >> >> You will also get that error if you don't have permission to read the gpo >> >> On 24 Mar 2010, at 18:09, "Darren Mar-Elia" <xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx>> wrote: >> >> Jamie’s right about the wildcard support (or lack thereof) in the current cmdlets. It is something I can add, but Jamie’s approach is probably quicker. What does sound like a significant issue is the error you’re getting when doing a get-sdmgpo *. I have seen this come up occasionally when there was a corrupted GPO in an environment. There shouldn’t be any limit on the number of GPOs we can enumerate. Jason, does it always crash on the same GPO? >> >> Darren >> >> From: xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Nelson, Jamie >> Sent: Wednesday, March 24, 2010 10:56 AM >> To: <mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> >> Subject: RE: [gptalk] SDM GPMC posh cmdlets >> >> I don’t think the cmdlet supports wildcards in the name. If you read the help for it, it expects one of the following: >> >> >> · A “*” to list all GPOs >> >> · The “friendly name” of a GPO >> >> · The GPO GUID (if using the –GPOID parameter) >> >> I think you would need to use the Where-Object approach to filter, and you’ll also want to use the –like or –match operators for doing a wildcard or regex filter. If you use -eq that is looking for a literal match and won’t work. >> >> Hope that helps. >> >> Jamie Nelson | Sr. Administrator | BI&T Infrastructure-Intel | Devon Energy Corporation | Work: ' 405.552.8054 | Mobile: ' 405.248.7963 | <http://www.dvn.com/> http://www.dvn.com >> >> From: xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> [mailto:xxxxxxxxxxxxxxxx] On Behalf Of Jason B. Halladay >> Sent: Wednesday, March 24, 2010 12:06 PM >> To: <mailto:xxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxx <mailto:xxxxxxxxxxxxxxxx><mailto:xxxxxxxxxxxxxxxx> >> Subject: [gptalk] SDM GPMC posh cmdlets >> >> Hi all, >> I've done a few GPO-related Powershell tasks using the SDM GPMC powershell cmdlets<http://www.sdmsoftware.com/freeware.php> (Thanks Darren!) and I'm running into an issue with my current task and I'm hoping someone has a suggestion to fix it or another way to solve it... >> >> I'm attempting to get a listing of all GPOs that start with the word "finance" so I can add a security right to it. Here's what I'm trying: >> get-SDMgpo -name "finance*" >> but that fails with the error: >> Get-SDMgpo : Unable to find selected GPO(s) >> At line:1 char:11 >> + get-sdmgpo <<<< -name "finance*" >> >> It seems the cmdlet doesn't like the wildcard in the name. So, OK, I try to get around it with: >> get-SDMgpo -name * | where-object {$_.name -eq "finance*"} >> but that eventually fails with: >> Get-SDMgpo : The system cannot find the file specified. (Exception from HRESULT: 0x80070002) >> At line:1 char:11 >> + get-sdmgpo <<<< -name * | where-object {$_.name -eq "finance*"} >> >> It appears it's an issue with the number of results being returned that is causing the HRESULT error because I get the same error when running: >> get-SDMgpo * >> >> That returns a bunch of GPOs (we have 1000+ GPOs in our environment) but eventually gives the same HRESULT error. >> >> I'm thinking I'll have to get the list of GPOs that match my criteria (e.g. name contains "finance") in some other way and import that to the add-SDMgposecurity cmdlet to meet my goal. Ideas or suggestions? >> >> Thanks, >> Jason >> >> -- >> >> Jason Halladay >> >> ________________________________ >> >> Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, retransmission, conversion to hard copy, copying, circulation or other use of all or any portion of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, and delete this message and any attachments from your system. >> >> >> >> >> -- >> >> Jason Halladay >> >> Los Alamos National Laboratory >> >> >> > > -- > > Jason Halladay > > Los Alamos National Laboratory > >
--
Jason Halladay
Los Alamos National Laboratory
| | | |
|
|