RE: Powershell question

2013-02-14 Thread Joseph L. Casale
arg to the invoke cmd and convert 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

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 System.

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 wrote: > On Fri, Oct 5, 2012 at 12:15 PM, Steven Peck 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*

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 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 $GroupName, but not

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 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 wrote: > I'm confused about something. I am writing a Powershell script, using > the Quest AD CMDLETs. I have a list o

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 make

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 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, powerful endpoint secu

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 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 the shared folders

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 P

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 $Process.StartInfo.RedirectStand

RE: Powershell question

2012-05-30 Thread Michael B. Smith
12 7:06 PM To: NT System Admin 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

RE: Powershell question

2012-05-30 Thread Joseph L. Casale
cons.com] Sent: Wednesday, May 30, 2012 4:41 PM To: NT System Admin Issues Subject: RE: 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-Proc

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 cer

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-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 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 A

RE: PowerShell question

2012-01-20 Thread Brian Desmond
nuary 19, 2012 7:58 PM To: NT System Admin Issues Subject: Re: PowerShell question On Thu, Jan 19, 2012 at 2:26 PM, Christopher Bodnar 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 &

Re: PowerShell question

2012-01-19 Thread Ben Scott
On Thu, Jan 19, 2012 at 2:26 PM, Christopher Bodnar 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 (Widgets). > Get-QADGrou

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 que

RE: PowerShell question

2012-01-19 Thread Christopher Bodnar
www.guardianlife.com From: "Michael B. Smith" To: "NT System Admin Issues" 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, Michael B. Smith Consultant a

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 Sub

RE: Powershell question

2011-01-04 Thread Joseph Heaton
that is awesome. Thanks Michael. >>> "Michael B. Smith" 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 = $member.S

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

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 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 then pipe that to a

RE: Powershell Question

2010-09-07 Thread Michael B. Smith
ttp://TheEssentialExchange.com -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 ha

RE: Powershell Question

2010-09-07 Thread Joseph L. Casale
o: NT 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

RE: Powershell Question

2010-09-07 Thread Joseph L. Casale
Original Message- From: 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, Micha

RE: Powershell Question

2010-09-07 Thread Michael B. Smith
y, September 07, 2010 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

Re: Powershell Question

2010-09-07 Thread Rubens Almeida
; > -Original Message- > 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 + &quo

RE: Powershell Question

2010-09-07 Thread Joseph L. Casale
al Message- 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.

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 wrote: > Hey Guys, > > What’s the most simple and elegant way to trap for the following variable > assignment: > > Eg. $sfDesktop = [Environment]::GetFolderPath("Desktop") > >

Re: Powershell Question

2010-05-10 Thread mck1012
Thanks Michael. That helped out. From: Michael B. Smith To: NT System Admin Issues Sent: Mon, May 10, 2010 8:17:21 AM Subject: RE: Powershell Question I can’t think of a way to EASILY do that without post-processing the input array

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 isn

RE: Powershell Question

2010-03-13 Thread Michael B. Smith
. Regards, 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 dri

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-03-12 Thread Brian Desmond
> Sent: 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

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

Re: Powershell Question

2010-03-12 Thread Steven Peck
what SNAPSHOT ID to reference, and then expose if I grep this > for the Volume name “+3 lines back”. So when I job this, and put its output > in a $JobOutput, I want to use $JobOutput for each volume that I expose to a > drive letter. That’s the part I am unsure how to do. > > > >

Re: Powershell Question

2010-03-12 Thread Steven Peck
ond.com > > > > c – 312.731.3132 > > > > From: 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

RE: Powershell Question

2010-03-12 Thread Joseph L. Casale
to a drive 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

RE: Powershell Question

2010-03-12 Thread Brian Desmond
m 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, Michael B. Smith Consultant and Exchange MVP http://TheEssential

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,

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 la

RE: Powershell Question

2010-01-14 Thread Michael B. Smith
s + " " + $source + " " + $dest cmd.exe /c $prog $param "cmd.exe /c $prog $param" popd } -Original Message- From: Joseph L. Casale [mailto:jcas...@activenetwerx.com] Sent: Thursday, January 14, 2010 4:21 PM To: NT System Admin Issues Sub

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 ame

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 --chmod=

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

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: htt