RE: Powershell question

2013-02-14 Thread Michael B. Smith
ToString() doesn't work for you? Convert-* don't work for you? I'm a little confused as to what you want to do... From: Joseph L. Casale [mailto:jcas...@activenetwerx.com] Sent: Thursday, February 14, 2013 7:14 PM To: NT System Admin Issues Subject: Powershell question Hey guys, I have a

RE: Powershell question

2013-02-14 Thread Joseph L. Casale
to an xml object to get the nice parsing/xpath ability... Thanks! jlc From: Michael B. Smith Sent: Thursday, February 14, 2013 5:21 PM To: NT System Admin Issues Subject: RE: Powershell question ToString() doesn't work for you? Convert-* don't work for you? I'm

Re: Powershell question - property to determine group vs user, using Quest Get-QADUser

2012-10-05 Thread Steven Peck
This will get only user type objects Get-QADGroupMember $GroupName -type 'user' This will get only user type objects AND users from any nested groups. Get-QADGroupMember $GroupName -type 'user' -indirect So if the rest of your script currently works that should be the only change you have to

Re: Powershell question - property to determine group vs user, using Quest Get-QADUser

2012-10-05 Thread Rob Bonfiglio
I think this should work for you: $TheUsers = Get-QADGroupMember $GroupName | where {$_.type -eq 'user'} | Select Name | Sort Name On Fri, Oct 5, 2012 at 11:36 AM, Michael Leone oozerd...@gmail.com wrote: I'm confused about something. I am writing a Powershell script, using the Quest AD

Re: Powershell question - property to determine group vs user, using Quest Get-QADUser

2012-10-05 Thread Steven Peck
So... $TheUsers = Get-QADGroupMember $GroupName -type 'user' At this moment you have the user objects and their properties so let's try $TheUsers | Get-Member Looking at the Properties field there is a AccountIsDisabled property.. yay. Lot's of other properties as well which is nice since you

Re: Powershell question - property to determine group vs user, using Quest Get-QADUser

2012-10-05 Thread Michael Leone
On Fri, Oct 5, 2012 at 12:15 PM, Steven Peck sep...@gmail.com wrote: So... $TheUsers = Get-QADGroupMember $GroupName -type 'user' At this moment you have the user objects and their properties so let's try Yes, but that's not all I want. I *do* want to see any groups that are members of

Re: Powershell question - property to determine group vs user, using Quest Get-QADUser

2012-10-05 Thread Michael Leone
On Fri, Oct 5, 2012 at 2:14 PM, Michael Leone oozerd...@gmail.com wrote: On Fri, Oct 5, 2012 at 12:15 PM, Steven Peck sep...@gmail.com wrote: So... $TheUsers = Get-QADGroupMember $GroupName -type 'user' At this moment you have the user objects and their properties so let's try Yes, but

Re: Powershell question - listing groups a user belongs to, and the notes/description of the group

2012-09-26 Thread Christopher Bodnar
With the Quest CMDLets this works: get-qaduser jdoe -properties memberof|select -expandProperty memberof|get-qadgroup|select name,notes Christopher Bodnar Enterprise Architect I, Corporate Office of Technology:Enterprise Architecture and Engineering Services Tel 610-807-6459 3900 Burgess

Re: Powershell question - listing groups a user belongs to, and the notes/description of the group

2012-09-26 Thread KenM
With Quest get-qadmemberof USERNAME | Select name, notes On Wed, Sep 26, 2012 at 10:44 AM, Michael Leone oozerd...@gmail.com wrote: I have this request to list all the groups a specific set of users belong to. Since we use groups to control ACLs, this can (effectively) be a listing of all

Re: Powershell question - listing groups a user belongs to, and the notes/description of the group

2012-09-26 Thread Michael Leone
On Wed, Sep 26, 2012 at 11:15 AM, KenM kenmli...@gmail.com wrote: With Quest get-qadmemberof USERNAME | Select name, notes Well, THAT was stunningly easy! LOL Thanks. That will make the report a whole lot easier, I think ... I will have to read up on these Quest addins ~ Finally,

RE: Powershell question

2012-05-30 Thread Michael B. Smith
You need to take a look at the operator and the invoke-command and invoke-expression cmdlets. Insofar as push the extra arg into the array list YUCK. Check out Start-Process and Wait-Process. The way you are using Verbose isn't the way it's MEANT to be used (although what you are doing

RE: Powershell question

2012-05-30 Thread Joseph L. Casale
: Powershell question You need to take a look at the operator and the invoke-command and invoke-expression cmdlets. Insofar as push the extra arg into the array list YUCK. Check out Start-Process and Wait-Process. The way you are using Verbose isn't the way it's MEANT to be used (although what you

RE: Powershell question

2012-05-30 Thread Michael B. Smith
Issues Subject: RE: Powershell question Actually, you are right about the -verbose, I forgot about that and simply opened up the first script. CmdletBinding enables all cmdlets to produce the output if they provide... I am not following you on the operator for the Some-Cmdlet example. I did try

RE: Powershell question

2012-05-30 Thread Joseph L. Casale
I didn't use Wait-Process below because I want the exit value. Did someone say exit code? $Args = New-Object System.Collections.ArrayList [void]$Args.Add(--Bad-Arg) $Process = New-Object System.Diagnostics.Process $Process.StartInfo.UseShellExecute = $false

RE: Powershell question

2012-04-03 Thread Michael B. Smith
Write a function. You can also do this with a filter, but almost no one uses filters. And it wouldn't reduce your line count any more than a function would. -Original Message- From: Joseph L. Casale [mailto:jcas...@activenetwerx.com] Sent: Tuesday, April 03, 2012 5:27 PM To: NT System

RE: Powershell question

2012-04-03 Thread Brian Desmond
How about something like this. You can figure out what $value1 and $value2 should look like (could just be your Test-Path calls or maybe the function is registry aware...). [bool]function XorValues($value1, $value2, [ref]$outputVal) { if ($value1 -xor $value2) {

RE: Powershell question

2012-04-03 Thread Joseph L. Casale
Thanks guys! From: Brian Desmond [br...@briandesmond.com] Sent: Tuesday, April 03, 2012 4:13 PM To: NT System Admin Issues Subject: RE: Powershell question How about something like this. You can figure out what $value1 and $value2 should look like (could

RE: PowerShell question

2012-01-20 Thread Brian Desmond
System Admin Issues Subject: Re: PowerShell question On Thu, Jan 19, 2012 at 2:26 PM, Christopher Bodnar christopher_bod...@glic.com wrote: I've got a PowerShell script that enumerates a list of groups and their members. Works great in the domain that I run the script from (acme.com). Trying

RE: PowerShell question

2012-01-19 Thread Michael B. Smith
DFL and FFL? Is Exchange in the mix? And if so, what version (including SP)? Regards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com From: Christopher Bodnar [mailto:christopher_bod...@glic.com] Sent: Thursday, January 19, 2012 2:27 PM To: NT System Admin Issues

RE: PowerShell question

2012-01-19 Thread Christopher Bodnar
www.guardianlife.com From: Michael B. Smith mich...@smithcons.com To: NT System Admin Issues ntsysadmin@lyris.sunbelt-software.com Date: 01/19/2012 03:07 PM Subject:RE: PowerShell question DFL and FFL? Is Exchange in the mix? And if so, what version (including SP)? Regards

RE: PowerShell question

2012-01-19 Thread Michael B. Smith
In that case, I've got no clue. Sorry... :( Regards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com From: Christopher Bodnar [mailto:christopher_bod...@glic.com] Sent: Thursday, January 19, 2012 3:30 PM To: NT System Admin Issues Subject: RE: PowerShell question

Re: PowerShell question

2012-01-19 Thread Ben Scott
On Thu, Jan 19, 2012 at 2:26 PM, Christopher Bodnar christopher_bod...@glic.com wrote: I've got a PowerShell script that enumerates a list of groups and their members. Works great in the domain that I run the script from (acme.com). Trying to make the same script work against a trusted domain

Re: Powershell question

2011-01-04 Thread KenM
download the Quest AD cmdlets get-qadgroupmember GROUPNAME | Select Name | out-file c:\users.txt On Tue, Jan 4, 2011 at 4:08 PM, Joseph Heaton jhea...@dfg.ca.gov wrote: I found this really simple powershell script that will list all members of a specified AD group. What I'd like to do is

RE: Powershell question

2011-01-04 Thread Michael B. Smith
Here is your updated script: - start - $root=([ADSI]).distinguishedName $Group = [ADSI](LDAP://CN=Domain Admins,CN=Users,+ $root) $members = $Group.member foreach( $member in $members ) { $ary = $member.Split( , ); $result = $ary[0].Substring(3); $result; } - end - If you put

RE: Powershell question

2011-01-04 Thread Joseph Heaton
that is awesome. Thanks Michael. Michael B. Smith mich...@smithcons.com 1/4/2011 1:17 PM Here is your updated script: - start - $root=([ADSI]).distinguishedName $Group = [ADSI](LDAP://CN=Domain Admins,CN=Users,+ $root) $members = $Group.member foreach( $member in $members ) { $ary =

Re: Powershell Question

2010-09-07 Thread Rubens Almeida
I'd try something like this: $sfDesktop = $env:USERPROFILE + \desktop On Tue, Sep 7, 2010 at 3:36 PM, Joseph L. Casale jcas...@activenetwerx.com wrote: Hey Guys, What’s the most simple and elegant way to trap for the following variable assignment: Eg. $sfDesktop =

RE: Powershell Question

2010-09-07 Thread Joseph L. Casale
- From: Rubens Almeida [mailto:rubensalme...@gmail.com] Sent: Tuesday, September 07, 2010 12:46 PM To: NT System Admin Issues Subject: Re: Powershell Question I'd try something like this: $sfDesktop = $env:USERPROFILE + \desktop On Tue, Sep 7, 2010 at 3:36 PM, Joseph L. Casale jcas

Re: Powershell Question

2010-09-07 Thread Rubens Almeida
[mailto:rubensalme...@gmail.com] Sent: Tuesday, September 07, 2010 12:46 PM To: NT System Admin Issues Subject: Re: Powershell Question I'd try something like this: $sfDesktop = $env:USERPROFILE + \desktop On Tue, Sep 7, 2010 at 3:36 PM, Joseph L. Casale jcas...@activenetwerx.com wrote: Hey Guys

RE: Powershell Question

2010-09-07 Thread Michael B. Smith
2:50 PM To: NT System Admin Issues Subject: RE: Powershell Question Hey Rubens, I am not too concerned with how I get the value, but more on how to trap if it doesn't enumerate correctly. Once I start looping through all the special folders of interest, I don't want to send something wrong

RE: Powershell Question

2010-09-07 Thread Joseph L. Casale
: Michael B. Smith [mailto:mich...@smithcons.com] Sent: Tuesday, September 07, 2010 1:46 PM To: NT System Admin Issues Subject: RE: Powershell Question Test-path is probably what you want. I'm not sure what you mean by enumerate correctly. Regards, Michael B. Smith Consultant and Exchange MVP

RE: Powershell Question

2010-09-07 Thread Joseph L. Casale
System Admin Issues Subject: Re: Powershell Question I think you can try this: $sfDesktop = [Environment]::GetFolderPath(Desktop) If(!(test-path $sfDesktop)) { write-host Something's wrong } Else { write-host It worked } On Tue, Sep 7, 2010 at 3:50 PM, Joseph L. Casale jcas

RE: Powershell Question

2010-09-07 Thread Michael B. Smith
-Original Message- From: Joseph L. Casale [mailto:jcas...@activenetwerx.com] Sent: Tuesday, September 07, 2010 4:09 PM To: NT System Admin Issues Subject: RE: Powershell Question Yeah, You have to pardon my lack of ps experience:) I really don't know what happens to that var if the expression bails

RE: Powershell Question

2010-05-10 Thread Michael B. Smith
I can't think of a way to EASILY do that without post-processing the input array: $in = gc file.txt $ary = @() for ($i = 0; $i -lt $in.Length; $i += 2) { $ary += $in[$i] } But that

Re: Powershell Question

2010-05-10 Thread mck1012
Thanks Michael. That helped out. From: Michael B. Smith mich...@smithcons.com To: NT System Admin Issues ntsysadmin@lyris.sunbelt-software.com Sent: Mon, May 10, 2010 8:17:21 AM Subject: RE: Powershell Question I can’t think of a way to EASILY do

RE: Powershell Question

2010-03-13 Thread Michael B. Smith
, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com From: Joseph L. Casale [mailto:jcas...@activenetwerx.com] Sent: Friday, March 12, 2010 4:48 PM To: NT System Admin Issues Subject: RE: Powershell Question Hey Michael, Here is some of the output of two snapped drives

RE: Powershell Question

2010-03-12 Thread Michael B. Smith
I'm going to say yes, but I'm still not exactly sure what you are going for there. Look at -match, findstr, and select. Regards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com From: Joseph L. Casale [mailto:jcas...@activenetwerx.com] Sent: Friday, March 12, 2010

RE: Powershell Question

2010-03-12 Thread Brian Desmond
: Powershell Question I'm going to say yes, but I'm still not exactly sure what you are going for there. Look at -match, findstr, and select. Regards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com From: Joseph L. Casale [mailto:jcas...@activenetwerx.com] Sent: Friday

RE: Powershell Question

2010-03-12 Thread Joseph L. Casale
letter. That's the part I am unsure how to do. Thanks! jlc From: Michael B. Smith [mailto:mich...@smithcons.com] Sent: Friday, March 12, 2010 2:42 PM To: NT System Admin Issues Subject: RE: Powershell Question I'm going to say yes, but I'm still not exactly sure what you are going for there. Look

Re: Powershell Question

2010-03-12 Thread Steven Peck
: Michael B. Smith [mailto:mich...@smithcons.com] Sent: Friday, March 12, 2010 3:42 PM To: NT System Admin Issues Subject: RE: Powershell Question I’m going to say “yes”, but I’m still not exactly sure what you are going for there. Look at “-match”, “findstr”, and “select”. Regards

Re: Powershell Question

2010-03-12 Thread Steven Peck
the part I am unsure how to do. Thanks! jlc From: Michael B. Smith [mailto:mich...@smithcons.com] Sent: Friday, March 12, 2010 2:42 PM To: NT System Admin Issues Subject: RE: Powershell Question I’m going to say “yes”, but I’m still not exactly sure what you are going for there. Look

RE: Powershell Question

2010-03-12 Thread Joseph L. Casale
so if you search for be35a053-2fee-4aa8-aa92-6bd1b2cf5e29 you want to put $JobOutput = 787bdf7a-ccff-11dd-9866-806e6f6e6963 or $JobOutput = D Neat function in previous email, but I am still not seeing how I do what I need. $JobOutput will contain many blocks all of that format, as an example, I

RE: Powershell Question

2010-03-12 Thread Brian Desmond
: Friday, March 12, 2010 5:21 PM To: NT System Admin Issues Subject: RE: Powershell Question so if you search for be35a053-2fee-4aa8-aa92-6bd1b2cf5e29 you want to put $JobOutput = 787bdf7a-ccff-11dd-9866-806e6f6e6963 or $JobOutput = D Neat function in previous email, but I am still not seeing

RE: Powershell Question

2010-03-12 Thread Joseph L. Casale
The Select-Object cmdlet is probably what you want. It has -First, -Last, -Skip, -Index, etc which you can use to step in to an array Cool, Is there any way to clean this up, I get an error when I consecutively pipe the $SnapOutput_Log and $GUID_Log lines together? $SnapOutput = start-job {

RE: Powershell Question

2010-01-14 Thread Michael B. Smith
is there a particular reason you want to use II? And I'm not completely clear about your quoting requirements, but I'd do something like this: $arrayPaths = Dir/1, Dir/2, Dir/3 -- don't need the initializer since you have the comma operator $options = '--verbose --recursive --blah

RE: Powershell Question

2010-01-14 Thread Joseph L. Casale
is there a particular reason you want to use II? And I'm not completely clear about your quoting requirements, but I'd do something like this: Nope, I actually don't know any better:) cmd.exe /c c:\Program Files\cwRsync\rsync.exe $options $source $dest Having an issue with this, so I amended

RE: Powershell Question

2010-01-14 Thread Michael B. Smith
...@activenetwerx.com] Sent: Thursday, January 14, 2010 4:21 PM To: NT System Admin Issues Subject: RE: Powershell Question is there a particular reason you want to use II? And I'm not completely clear about your quoting requirements, but I'd do something like this: Nope, I actually don't know any better

RE: Powershell Question

2010-01-14 Thread Joseph L. Casale
This would be why I said I wasn't clear on your quoting requirements. :-) I know the whole Cygwin thing combined with PowerShell combined with cmd.exe can be a littlestrange. This seems to work, on my system. The amount of beer debt I amassing in your favor is getting to be rather large:)

RE: Powershell Question

2009-01-06 Thread Michael B. Smith
This is a good start, and provides links http://technet.microsoft.com/en-us/magazine/2007.11.powershell.aspx Here is a link to the definitive reference: http://msdn.microsoft.com/en-us/library/hs600312.aspx Regards, Michael B. Smith, MCITP:SA,EMA/MCSE/Exchange MVP My blog:

Re: Powershell Question

2009-01-06 Thread Steven Peck
Also, while I don't use regex much, the few times I have Regex Buddy was invaluable. http://www.regexbuddy.com/ And Micheal beat me to the link I use whenever I need a refresher. (ok, the link I read when I have to use regex) Brandon is evidently going to post more on the subject so you may want