Friday, October 28, 2011

Today the postman delivered the two brand new copies of book “Windows PowerShell 2.0 Bible” published by “John Wiley & Sons, Inc.” and written by “Thomas Lee”, “ Karl Mitschke” , “Mark E. Schill” and “Tome Tanasovski”.

This Book send to us by “Mark E. Schill”

From the behalf of “New Delhi PowerShell user Group” Thanks a lot “Mark E. Schill” and also thanks to “Wiley Publications” too to send a complimentary copy of it ..

Friday, October 21, 2011

Sometime you want to run PowerShell commands in Batch (.bat) files or may be from old command shell (cmd.exe) due to some specific needs or you may want to replace your old dos based email program with “ Send-MailMessage” , and you was thinking how to do it , let me show to you

Thursday, October 20, 2011

Do you ever want to see what going on users machines? or what Settings he have on his system,?

If you have few users in your office then you can go to there desk and check it manually, but –whatif ? you have hundreds on users or you are supporting a remote users.

I just came to same problem when i want to support a remote users and he don’t know how to run “Task manager”, how to open “RUN” dialogue box so that we can run “Msconfig” to view the list of soft wares which are on system startup list , and the internet connection was very low at his end and i can’t be able to do anything remotely.

To overcome from this situation I wrote a little script which get the system info and put everything in a HTML file and when when script done it open the HTML file in Internet Explorer. Then you can ask user to send that HTML file to you by email.

This script is using “WMI” queries to find the information , using get-wmiobject command and the covert everything to HTML using “Convertto-Html” cmdlet and save the output in to a file.

Currently the the HTML report contains .

BIOS Information

Physical Disk Drives

List of Network Adapters

Operating System Information

Logical Disk Drives

IP Addresses for each Network Card

List of Startup softwares

Running Processes

List of Services [ Whose “startup” mode is set “Automatic” but they are currently “Stopped” for some reason]

you can also add more “wmi” queries in to the script. like, Battery info, CDROM Drive info, Printer info etc in to it.

I tested the script on “Windows7” and it is working perfectly.

The output of the script will be found at : C:\Users\USERNAME\Computername.html

Tuesday, October 18, 2011

may be you are wondering what is its meaning, it mean how we can use PowerShell with in a PowerShell as a child process

It is very useful when we want to call a cmdlets or script within PowerShell Script.

Syntax

Syntax is Simple type PowerShell following by Curly Braces and in Curly braces you can provide any script, or cmdlet.

PowerShell { }

for example open PowerShell console and type the below command:

powershell {Get-ChildItem c:\}

How we know that its the above command running as Child Process not as a same process.

okays I have a proof.

Currently there is only one “PowerShell.exe ” process is running.[fig.1]

fig.1

now execute our command as let’s see what happens [fig.2]

fig.2

now see below when we execute the script a new child “PowerShell.exe” process starts beneath our old “PowerShell.exe” process and when it done executing it the child process will exit automatically [fig.3]

Hi Guys,
Did you ever tried to send HTML formatted colour coded email using PowerShell ? I was trying to do it but didn’t get any good and useful information on it, but i finally manage to get it done.
So lets start:
For example i am sending a test email from my official account to my GMAIL account.
the script will look like this:

Note: Make sure you use –BodyasHtml parameter in Send-MailMessage otherwise it send as plain text format.
Now lets see how this email will look like :)
Cool!!! it look exactly how we have define it in our Script :)
you can find more HTML coded which you can use in script from here http://www.w3schools.com/html/default.asp