Feeds:
Posts
Comments

Posts Tagged ‘powershell’

This came up, does PowerShell show public members of internal classes?

Yes we do, here’s proof.

Add-Type @”
    public class Top
    {
        internal class Inside
        {
            public string Hi() { return “Hi”; }
        }
       
        public static object GetInside()
        {
            return new Inside();
        }
    }
“@
[Top]::GetInside().Hi()
Hi

Hi is returned as the result of a public method on an internal class.

Privately public,
Waim Blue

Advertisements

Read Full Post »

I use my inbox, as a todo list, inspired by GTD, but there is no way I can figure out what to do, if I have 500 items. I want to cut it down, get rid of the junk, file the references in the right places, group related ones into projects, and mark out high-pri stuff.

I think PowerShell can help me here. It can help me figure out, what exactly is in my inbox, where are they coming from, and show me views which are more actionable.

For example, I should be able see all the emails sent from a machine, as opposed to a person. There probably junk. Also, I should be able to filter out discussion aliases, and those could be junk. Team mail, mail from peers and managers probably belong in one bucket, and personal stuff in another.

I got some links to try out
– http://grinding-it-out.blogspot.com/2008/04/little-powershell-fun.html
– http://blogs.msdn.com/jmanning/archive/2007/01/25/using-powershell-for-outlook-automation.aspx

I start with
PS C:\Users\ibrar> $inbox.Items.Count
531
Ouch.

Ok, who are my top senders
function Get-TopSenders($emailList) {
    $emailList.Items | group SenderName | sort count
}
Get-TopSenders -emailList $inbox

Here are a few,
   15 Osama ..
   18 James ..
   30 Jon ..
   32 Ibrahim ..
   36 Lucio  ..
   68 Refaat ..

200 out of 531, which is a good place to start

Next I did, find me all external (non-microsoft) mail
@($inbox.Items) | ?{$_.SenderEmailType -eq ‘SMTP’} | select SenderName,Subject
It gives me 42 mails. Microsoft mail would have the type ‘EX’

Next, I have my list of things I can filter on, general keywords, like OOF

That’s about as far as PowerShell would get me
I ran out of ideas, and AD is not working well for me. It would be nice if I could just go, “Which sender doesn’t have a last name”? (Machine senders)

I’m at zero inbox, but with a lot of manual filtering. Sigh. 40 Items in my ‘basket’ (should be called inbox, hurm), 16 project folders, and a full calendar for 1 week, hopefully I will reach true zero by EOD Friday

Thinking about it, I should also add rules based on receiver. Am I the only receiver, was it sent to a DL, etc.

Faking Zero for now,
Waim Brown

Read Full Post »

Urgh…

I get all these fake bots following me, and like urgh…

Well, my theory is, anyone who follows more than 1000 people must be a bot, and PowerShell could be hacked together to help me find that list.

Its looking good,

$wc = new-object System.Net.Webclient
$wc.Credentials = new-object System.Net.NetworkCredential “waim”,”MY_PASSWORD_TRY_IT”
$followers = [xml]$wc.DownloadString(“http://twitter.com/statuses/followers.xml?screen_name=waim”)

$friends = [xml]$wc.DownloadString(“http://twitter.com/statuses/friends.xml?screen_name=waim”)
$friends = $friends.users.user | select -ExpandProperty screen_name

$followers | select screen_name, @{Expression={[int]($_.friends_count)};Name=”Count”},@{Expression={“http://twitter.com/$($_.screen_name)”};Name=”Link”} | sort count | ft -AutoSize

What I did was find my friends list, find my followers list, then find all the followers who are not my friends.

Then, I sort them by number of people they follow

screen_name     Count Link
———–     —– —-
abdrahman82        12 http://twitter.com/abdrahman82
OnlineAlarmClck    38 http://twitter.com/OnlineAlarmClck
madelenej          47 http://twitter.com/madelenej
RedmondHV         152 http://twitter.com/RedmondHV
alexandair        178 http://twitter.com/alexandair
ebgreen           195 http://twitter.com/ebgreen
DrRez             690 http://twitter.com/DrRez
Jerejak           799 http://twitter.com/Jerejak
twirex            912 http://twitter.com/twirex
PaulPetterson    1050 http://twitter.com/PaulPetterson
danphilpott      1211 http://twitter.com/danphilpott
NocturnalJungle  1438 http://twitter.com/NocturnalJungle
SpencerFerguson  1809 http://twitter.com/SpencerFerguson
visiblenet       2001 http://twitter.com/visiblenet
Deskcretary      4668 http://twitter.com/Deskcretary
E_Stampede      15051 http://twitter.com/E_Stampede

Nice list.

The first guy is amy brother in law who is drowned out by the spam bots. Its nice to see him there, so I can add him as a friend

500+ seems to be a threshold, everyone after that is a BOT

alexandair        178 http://twitter.com/alexandair
ebgreen           195 http://twitter.com/ebgreen

Are powershell peeps. They follow a lot, but they also have a lot of followers. A delta might be a better judge of Botyness. Like that word, lets use it in the title

I still havent updated the script to block all the bots. Maybe later, at least now I know who are enemy

If you hear this, you are the resistance,

Waim Brown

Read Full Post »