Re: [powershell] Powershell array question and formatting question

2017-10-19 Thread Devin Rich
hoice there for you. Thanks, Devin Rich Systems Administrator On Thu, Oct 19, 2017 at 11:33 AM, Raymond Peng wrote: > Hi All, > > > > Still picking up powershell so please let me know if you see any obvious > blunders: I see it say the collection is of a fixed size but

Re: [powershell] Largest 32 items in multiple subdirectories

2017-07-21 Thread Devin Rich
| Select -First 1000 on a folder with some files and had no issues. Even running the ls | Select -First 1 -Expand Length in an empty folder works fine for me. And piping that all to measure-object -sum ).Sum just returns 0. Thanks, Devin Rich Systems Administrator On Fri, Jul 21, 2

Re: [powershell] Largest 32 items in multiple subdirectories

2017-07-20 Thread Devin Rich
Ooops, didn't see you were using -Property from measure-object. Why does spaces in your input object cause it to fail... that's a weird one. ... Thanks, Devin Rich Systems Administrator On Thu, Jul 20, 2017 at 9:44 PM, Devin Rich wrote: > Ok, couple other things :) > >

Re: [powershell] Largest 32 items in multiple subdirectories

2017-07-20 Thread Devin Rich
$CurrentVersion which is the full path from earlier. I'd say keep the Select -Expand FullName from your first line and then get rid of the .FullName from accessing the output. Thanks, Devin Rich Systems Administrator On Thu, Jul 20, 2017 at 9:30 PM, Devin Rich wrote: > The $CurrentVersion bef

Re: [powershell] Largest 32 items in multiple subdirectories

2017-07-20 Thread Devin Rich
u can also do: [int]$CurrentVersionLargest32 = (Get-ChildItem $CurrentVersion -recurse | Sort-Object length -descending | select-object -first 32 | measure-object -property length –sum).sum / 1GB This forces it to round to nearest GB. :) Good luck! Thanks, Devin Rich Systems Administrator On Thu

Re: [powershell] RE: PowerShell.exe from cmd - WMI filter quotes

2017-06-06 Thread Devin Rich
I think Eric's works, you just missed the opening ' before Portname. :) I like Where-Object, but if I need server side performance, then I will use -Filter (typically with large AD domains). Thanks, Devin Rich Systems Administrator On Tue, Jun 6, 2017 at 10:10 AM, Daniel Ratliff wr

Re: [powershell] PowerShell.exe from cmd - WMI filter quotes

2017-06-06 Thread Devin Rich
Object win32_printer | ? {$_.Portname -like '*.*.*.*'} | select Name, PortName | ConvertTo-Csv -NoTypeInformation | out-file c:\temp\%Hostname%_printers.csv}" That work for your needs? Thanks, Devin Rich Systems Administrator On Tue, Jun 6, 2017 at 9:11 AM, Daniel Ratliff wrote: > A

Re: [powershell] RE: What are the best PowerShell books out right now?

2017-05-31 Thread Devin Rich
ently is getting it to play nice in *nix systems (*nix commands, ssh PS remoting, etc.) v5.x may receive security fixes and new features, but don't expect too much development there. Thanks, Devin Rich Systems Administrator 801-576-4408 On Wed, May 31, 2017 at 3:12 PM, Michael B. Smith w

Re: [powershell] RE: What are the best PowerShell books out right now?

2017-05-31 Thread Devin Rich
tween them (they are bridged too). People are happy to help, even with noob questions. This is an incredibly powerful resource when you don't understand a line of code or want help doing a specific task. Thanks, Thanks, Devin Rich Systems Administrator On Wed, May 31, 2017 at 6:26 AM, Dan

Re: [powershell] Remove anything between defined characters:

2016-11-30 Thread Devin Rich
n it would ONLY work when the parenthesis is after the first name. Does that make sense? Thanks, Devin Rich Systems Administrator On Wed, Nov 30, 2016 at 2:27 PM, Orlebeck, Geoffrey < geoffrey.orleb...@montagehealth.org> wrote: > That’s much more elegant than anything I was coming up with

Re: [powershell] Remove anything between defined characters:

2016-11-30 Thread Devin Rich
I would do it this way because i'm lazy: -replace " ?\(.*?\) ?" PS > "(ywfew) Jessica (Yvs)" -replace " ?\(.*?\) ?" Jessica PS > "(ywfew)Jessica (Yvs)" -replace " ?\(.*?\) ?" Jessica PS > "Jessica (Yvs)" -replace "

Re: [powershell] bash in ISE?

2016-09-14 Thread Devin Rich
). Is getting it working right this time going to save time in the future? Probably. Would getting it working this time with WinSCP save time in the future? Probably. I guess it just depends on what you want to do. Good luck! Thanks, Devin Rich Systems Administrator On Wed, Sep 14, 2016 at 8:07 AM

Re: [powershell] RE: Get-ADUser and RegEx:

2016-08-29 Thread Devin Rich
version of powershell. 3. My understanding is that filter isn't not a regex. I don't use it much, but iirc, it is more like a SQL where clause and not a powershell one: much more limited filtering, but it is more efficient if it can handle search. I think you're on the right trac

Re: [powershell] Kill Processes Across Multiple Computers:

2016-06-14 Thread Devin Rich
h can be configured through GPO). If you don't have WinRM setup for these machines, you'll have to do the painful ways for remotely managing machines... Thanks, Devin Rich Systems Administrator First Electronic Bank 801-576-4408 On Tue, Jun 14, 2016 at 3:18 PM, Orlebeck, Geoffrey < ge

Re: [powershell] Kill Processes Across Multiple Computers:

2016-06-14 Thread Devin Rich
I forgot to note 1 thing: Invoke-Command does NOT work against your local machine. My understanding is that because you can't establish a remote session to yourself, it fails to connect. So be sure to test this against a remote computer. Thanks, Devin Rich Systems Administrator On Tue, J

Re: [powershell] Kill Processes Across Multiple Computers:

2016-06-14 Thread Devin Rich
-ComputerName $Server -Name "Inspector*","Procwall*","RedCloak*" If ($Process) { $Process | Stop-Process -Force Set-Service Redcloak -StartupType Disabled } } } Thanks, Devin Rich Systems

Re: [powershell] RE: CSV Comparisons:

2016-05-25 Thread Devin Rich
dexecutiontime - (history)[-1].startexecutiontime).TotalSeconds Thanks, Devin Rich Systems Administrator On Wed, May 25, 2016 at 12:00 PM, its.mike wrote: > 2 ¢: > > > > I'd try a hash table, created from the 9k DNS entries. > > > > Then spin the 260k fil