Welcome to: Absoblogginlutely! -

Absoblogginlutely (weekly) No comments yet

Posted from Diigo. The rest of my favorite links are here.

Absoblogginlutely (weekly) No comments yet

Posted from Diigo. The rest of my favorite links are here.

Absoblogginlutely (weekly) No comments yet

Posted from Diigo. The rest of my favorite links are here.

Absoblogginlutely (weekly) No comments yet

Posted from Diigo. The rest of my favorite links are here.

Install telnet from the command line No comments yet

pkgmgr /iu:"TelnetClient"
Wait a bit for the install to finish.
I do wish that pkgmgr would actually wait until the install has finished before coming back to a dos prompt as it's annoying that you have no idea when the install has actually completed. On my machine it takes about 30 seconds.
I'm finding it hard to believe that my laptop did not have telnet on it - as I use it all the time. However whenever I install telnet from the dos prompt I always have to look up the syntax (and it's still quicker than going into add/remove programs.
Hopefully this blog post will hit the search engines and therefore the syntax will be displayed on the first page rather than having to open a Microsoft page, scroll down and then view the syntax.

Absoblogginlutely (weekly) No comments yet

Posted from Diigo. The rest of my favorite links are here.

Find mailboxes that have the Email Address Policy disabled No comments yet

Took me a while to work this one out but the powershell line for this is

get-mailbox | where {$_.EmailAddressPolicyEnabled -eq $false}

Or you could switch it to the following but this is less easy to read for junior techs to understand as the ! is not necessarily obvious.

get-mailbox | where {!$_.EmailAddressPolicyEnabled}

Absoblogginlutely (weekly) No comments yet

Posted from Diigo. The rest of my favorite links are here.

Absoblogginlutely (weekly) No comments yet

Posted from Diigo. The rest of my favorite links are here.

Pimp your Powershell Prompt No comments yet

I use powershell a lot at work – I’m not a guru by any means and I often find it hard to remember the commands I have run in a session, either for future use or for documenting in my time sheet (which also acts as a point of reference for future helpdesk tickets).

When I started going through the Powershell in a month of lunches book (which I highly recommend or the Powershell v3 book) I decided to use the start-transcript commandlet to record all my powershell activities.  This worked very well until I would scroll through several screens worth and then forget what file I had saved my transcript too.  There was also the possibility of forgetting to transcript everything.

By using the powershell profile file I was able to enter the commands to automatically set the transcript to the current date. I was then able to modify the title of the powershell prompt to display the filename so I could always see where the file was saved with the added bonus of a variable being used if I ever needed to open the transcript

My next step was to include the time in the powershell prompt – this enables me to go back through the transcript and see how long it took to run the commands for my timesheet entries.  Remembering back to the good old dos days, I remembered the prompt command. A quick bit of experimenting with the Date command I had the current time displayed at the beginning on the Powershell prompt. Note this is displayed after the previous command is run, so technically it’s not the exact current time, but the time that the prompt was displayed on the screen.

The final profile script can be copy/pasted into notepad by typing in

notepad $profile

is as follows:-

cd \andy\powershellinamonthoflunches

$log="c:\temp\powershelllogs-" + $env.username + (get-date -uformat "%y%m%d-%H%M") + ".txt"
start-transcript $log
$host.ui.rawui.WindowTitle = $log

function prompt
{
write-host ((Date -uformat %T).ToString() + "PS " +$(get-location) + ">") -nonewline
return " "
}

This ends up with a powershell prompt that looks like the following. Hope this brief posting inspires you to change your powershell prompt to be even more useful for you.

 

Powershell prompt with the filename in the title and current time in the prompt

 

Top of page / Subscribe to new Entries (RSS)