Tech Support Websites

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 29 November 2011

Pluralsight Introduction to PowerShell Course - Notes

Posted on 11:34 by Unknown

Summary of the 2hour 40 minute duration Pluralsight  Introduction to PowerShell course, including other interesting material I found -

+ What is PowerShell?
Windows PowerShell command-line interface is a new command-line tool
It's a scripting language from Microsoft that complements Cmd.exe in the Windows administration context.
Based on .NET
Everything is a .NET object
PowerShell version 2 is included with Windows 7, Windows Server 2008 R2, XP SP3, Windows Server 2003 SP2, Windows Vista SP1
PowerShell scripts have a .ps1 extension

+ How to get started?
To start working with Powershell, go to Windows Accessories & select Windows PowerShell.

PowerShell Environments:
Out of box – PowerShell command window, PowerShell ISE (Integrated Shell Environment)
Free ISE’s – PowerSE, PowerGUI
Commercial

PowerShell ISE or Integrated Scripting Environment is  a GUI for working with PowerShell
You can hide the Script panel in PowerShell ISE if you work a lot in Interactive mode. In the Script pane, you can run either entire script (F5) or run a selection of commands with F8

+ Why learn PowerShell?
In the SharePoint 2010 administration context, Windows PowerShell supersedes the Stsadm.exe administration tool.
Windows PowerShell scripts can also be used to administer other Microsoft server products. This gives administrators a common scripting language across servers.
SQL Server 2008 introduces support for Windows PowerShell.
Windows PowerShell lets SQL Server administrators and developers automate server administration and application deployment.
The Windows PowerShell language supports more complex logic than Transact-SQL scripts, giving SQL Server administrators the ability to build robust administration scripts.
SQL Server cmdlets support actions such as running a sqlcmd script containing Transact-SQL or XQuery statements.
SharePoint 2010 has some 500+ cmdlets.

+ Commands in PowerShell are in the form of Cmdlets (“pronounced Command-lets”).
PowerShell commands have a Verb-Noun syntax. Example:
Get-command – retrieves a list of all system commands that are currently loaded into the PS environment

+ Common verbs:
Get
Set
Out
Start
Stop
Restart
Add

+ Common Nouns:
Help
Command
Service
Computer
Location
Childitems

You can pass parameters, verbs or nouns, to  view cmdlets featuring those keywords
Get-command –verb “get” : will get all cmdlets that have the verb get
Get-command –noun “service” : all cmdlets that have the noun service

To find explanation about at command: get-help get-command
get-help get-command - examples
get-help get-command -detailed
get-help get-command –full

To view environment variables:
Clear-Host
Set-Location env:
Get-children

Show list of snap-ins:
Clear-Host
Get-pssnapin

Show list of registered snap-ins:
Clear-Host
Get-pssnapin –registered

+ What is a PowerShell snap-in?

A PowerShell snap-in is a .NET assembly or set of assemblies that contains cmdlets, providers, type extensions, and format metadata.
All the commands and providers that ship as part of the Windows PowerShell product are implemented as a set of five snap-ins. You can view the list of snap-ins using the get-pssnapin cmdlet.
When a snap-in is loaded in Windows PowerShell, all cmdlets and providers in the snap-in are made available to the user. This model allows administrators to customize the shell by adding or removing snap-ins to achieve precise sets of providers and cmdlets.
PowerShell built-in snap-ins, such as Microsoft.PowerShell.Host, cannot be removed.
You write a snap-in when you want your cmdlets or providers to be part of the default Windows PowerShell.


+ Aliasing makes it easy for a lot of commands to be mapped to specific PowerShell commands.
Useful for folks transitioning from Linux or DOS. Dir & ls are both mapped to get-childitem, they are both aliases
You can set your own aliases. Example: set-alias list get-childitem # will create a alias called list to display directories & files
The lifetime of this “list” lasts till this PowerShell window is open
It is possible to save your aliases into a file & re-load them. Example: Export-alias c:\ps\myalias.csv list (wildcards also possible)
When you reopen window, use this - import-alias c:\ps\myalias.csv & then use list. You can load a whole bunch of aliases within a csv file & load them when you want to.

+ Pipelining – combining cmdlets for power. Examples:
Get-childitem | where-object {$_.Length –gt 100KB}
$_ represents the current object

Get-childitem | where-object {$_.Length –gt 100KB} | sort-object length

Get-childitem | where-object {$_.Length –gt 100KB} | sort-object Length |
Format-Table -Property Name, Length –AutoSize

Get-childitem | select-object Name, Length
select-object can be used to retrieve certain properties from an object

Get-ChildItem | Where-Object {$_.Name – like “*.ps1”}

+ Provider is a .NET library that provides a standard interface through which we can navigate through whatever object a provider represents.
Providers can extend the list of cmdlets that are available to you.
Get-psprovider command shows a list of providers we have currently loaded in our environment.
Each one of these providers reveals itself to us through the form of Drives. It is through these Drives that we can navigate & retrieve data.

+ Variables:
Get-Variable – displays the variable & its value
Set-Variable – assign a new value to an existing variable
Clear-Variable – clears the contents of a variable. Variable still exists but without any value
Remove-Variable – wipes out a variable.

+ Automatic variables:
$false, $true
$pwd – current directory
$Home – users Home directory
$host – info about a users machine
$PSVersionTable – info about the current version of Powershell
$PID – process ID
$_ - special variable name to represent the current object

+ Strings:
String comparisons are case insensitive by default
To get quotation marks within a string, use mixed quotes or use the quotation mark twice
Here String - for storing large blocks of text, enclose the string within quotes & then precede & terminate quotation marks with @. Lines containing the “@” should exist independently.
Expressions can be used in strings & they need to be wrapped in $(). Example - “There are $((Get-ChildItem).Count) items in the folder $(Get-Location)”
Wildcards & Regular expressions are supported. Example - “Pluralsight” –like “Plural*[s-v]”

+ Arrays:
Arrays in PS are zero-based
$array = “plural”,”sight”
$array = @(“plural”,”sight”)
$array = 1..5  #numeric range notation
The formal array creation syntax is useful when creating a blank array -  $array = @()

+ Hash tables:
$hash = @{“key” = “value”;}
$hash[“mvark”] = “mvark.blogpsot.com”
$hash.Remove(“mvark”) #remove by passing in key
$hash.Contains(“mvark”) #see if key exists
#list keys & values
$hash.Keys
$hash.Values

+ Branching and Looping constructs:
PowerShell supports Branching construct like if-else, switch and Looping constructs like while, do-while, do-until, for, foreach
PowerShell has if & else but doesn’t have if elseif
Switch will match all lines that match. To stop processing once a block is found use break
Switch works with collections, looping & executing for each match
Break – exits the loop on first hit. When used in a nested loop, break exits to the outer loop
Continue – to skip the rest of a loop but go onto the next iteration
Trap – to catch exceptions
Use loop labels to break to a certain loop

+ Script block:
A basic script block is code inside {}. The for (as well as other loops) execute a script block
To put multiple commands on a single line use the ;
You can store script blocks inside a variable
$cool = {Clear-Host; “Powershell and bowties  are cool”}
To run the variable precede it with a &. Example: & $cool
You can use return to return a value. Once it is used, the script exits
"process" is used to pipeline enable a block
Variables declared outside a block are useable inside a block
If you try to change the variable inside a block, PS makes a local copy & uses that, leaving the original alone

+ Functions are basically script blocks with names.
No parentheses or commas required to separate parameters
To add Help to your functions, use custom tags within a comment block and Get-Help can recognize them.

+ Filters are alternatives to functions; work like the Where-Object cmdlet
Filters can be built to remove unwanted files

+ Files:
Contents of a file are stored in a array
Get-Content - can display a file. Get-Content supports wildcards
Set-Content -  write text to a file. It can however be destructive. If a file already exists, it’s overwritten
Add-Content - to append text to a file
User-defined functions can be defined in a .PS1 file & it can be referenced in a script using Import-Module
$psise is a special variable that represents PowerShell Integrated Server Environment
.ps1 can be omitted while running script from the command prompt

+ Other references:
Windows PowerShell Quick Reference
Windows PowerShell Survival Guide

In this course, the presenter Robert Cain has done a good job of covering the basics of PowerShell at a relaxed pace. He has a charming style of delivery & his accent should be easy to follow even by international audiences.
Read More
Posted in PowerShell, Sharepoint, SQL Server | No comments

Monday, 14 November 2011

HOW TO Google specifically for discussions/answers on only online forums instead of articles

Posted on 07:50 by Unknown

There may be times when you want to look for results for a particular keyword or phrase from among discussion boards and online forums. For instance, you may want to know about opinions on solving a complex programming issue or find the experiences of people with a particular ailment or gauge the reactions of food aficionados to some exotic recipe. In such cases, articles don't help and to cut to the chase, you can turn to Google Groups Search. It now gets results from not just threads within Google Groups but also other online forums. Currently, not all forum sites are included & a glaring omission seems to be the StackExchange family of Q & A sites.

Adding Google Groups as a search engine is relatively easy in Chrome & Opera than the other browsers. Once you configure Google Groups as a search provider within Chrome...

...you can type the keyword you assigned that provider (I choose "grp" to represent Google Groups Search) followed by your search query. When you type the search provider's keyword and hit space, a label corresponding to the search engine name would show up in the Omnibox.

Keywords specified while configuring search providers make it easy to switch between search engines in the browser.
Read More
Posted in Browsers, Chrome, Google, HOWTO | No comments

Sunday, 16 October 2011

HOW TO delete an email address from GMail auto-complete list without deleting Contact

Posted on 01:10 by Unknown
Supposedly friendly features like spell-check & auto-completion can be a bane sometimes. Imagine if your boss & best friend share the same name & you excitedly send a very private message to the boss instead of the friend because GMail cleverly fills the email address while you type a few characters of the name. If such a scenario rings a bell, here is one option to prevent GMail from supplying names you don't want to see in the email auto-complete list that appears while composing a mail.

The easy way is to delete the contact. But if you want to prevent an email address from showing up in GMail auto-complete list when you try names in the To:, CC: or BCC: fields, then you can consider moving the email address from the Email field in the form for that Contact to the Notes field.
click on image to enlarge

Read More
Posted in GMail, HOWTO, Tip | No comments

Friday, 7 October 2011

HOW TO compare HTML5 features supported by versions 8, 9 & 10 of IE

Posted on 11:24 by Unknown
This page on the Browserscope website lets you choose versions of the same or different browsers & see how they stack up in supporting HTML5 features. Click on the "Compare UAs" link on that page, select User Agents you want to compare & then hit the Compare button.

I chose versions 8, 9 & 10 of Internet Explorer to see what's new with respect to HTML5 in IE9 & IE 10
click to enlarge image

You can copy the table data to Excel & transpose the columns to rows to view the tabular data vertically as a list (in Excel2010, click on Paste dropdown in Ribbon & select Transpose).

So here is the list of HTML5 supported features in IE9 as detected by Browserscope by utilizing Modernizer 2.0.4 -
  1. audio:m4a 
  2. audio:mp3 
  3. backgroundsize 
  4. borderradius 
  5. boxshadow 
  6. canvas 
  7. canvastext 
  8. csstransforms 
  9. draganddrop 
  10. fontface 
  11. generatedcontent 
  12. geolocation 
  13. hashchange 
  14. hsla 
  15. inlinesvg 
  16. localstorage 
  17. multiplebgs 
  18. opacity 
  19. postmessage 
  20. rgba 
  21. sessionstorage 
  22. smil 
  23. svg 
  24. svgclippaths 
  25. video:h264 
 IE10 additionally supports the following HTML5 features -
  1. applicationcache 
  2. cssanimations 
  3. csscolumns 
  4. cssgradients 
  5. csstransforms3d 
  6. csstransitions 
  7. history 
  8. indexeddb 
  9. input:autofocus 
  10. input:list 
  11. input:max 
  12. input:min 
  13. input:multiple 
  14. input:pattern 
  15. input:placeholder 
  16. input:required 
  17. input:step 
  18. inputtypes:email 
  19. inputtypes:number 
  20. inputtypes:range 
  21. inputtypes:search 
  22. inputtypes:tel 
  23. inputtypes:url 
  24. textshadow 
  25. websockets 
  26. webworkers 
Also see:
Comparison of layout engines (HTML5)
HTML5 compatibility across major mobile and tablet browsers

Read More
Posted in Browsers, HTML5, IE | No comments

Thursday, 6 October 2011

Scott Allen's 10 favorite C# rules for developing software

Posted on 06:38 by Unknown

From Scott Allen's C# Fundamentals Part 2 course on Pluralsight -

Rule #10: Avoid Regions - as they are typically used to hide ugly code or classes that've exploded in size or responsibility. Think if you should break the regions into seperate classes
Rule #9: Use exceptions for errors..instead of status code or booleans...but not for control flow
Rule #8: Avoid boolean parameters
Rule #7: Avoid too many parameters - beyond 4, consider grouping
Rule #6: Warnings are errors - Go to a Project's Properties and in the Build tab of the dialog box that opens up, change "Treat warnings as errors" to All from the default None
Rule #5: Encapsulate complex expressions - Instant recognition is good
Rule #4: Try to avoid multiple exits - have just one
Rule #3: Try to avoid comments - A meaningful method name is more effective than comments. Triple slash comments in VS are ok as they help in documentation of an API. Other developers can see your comments through Intellisense when they reference your assembly.
Rule #2: Keep methods short - general rule of thumb: 1 to 10 lines
Rule #1: Keep classes small

+ The foundation for most C# coding standards is Microsoft's "Design Guidelines for Developing Class Libraries"
+ ReSharper VS Plugin & StyleCop can help you enforce naming conventions
+ Names contain meaning & adding meaning to code is what readability is all about - use meanigful names
+ Embedding type in the name of a variable is not a good idea especially for primitive types. Name should indicate what an variable or object can do & what it represents.
+ How to improve readability of your code - read other people's code to figure what is good & what is bad. Be introspective.
Read More
Posted in C# | No comments

Tuesday, 4 October 2011

Thrilled to be among top Pro Webmasters Stack Exchange users to receive swag

Posted on 21:30 by Unknown
I'm a fan of several sites of the Stack Exchange family. I was thrilled to know that I'm among the top Pro Webmasters Stack Exchange users with over 950 reputation to receive cool swag. Thank you, Stack Exchange!

The Stack Exchange family currently consists of 65 question and answer sites & has over 1.2 million users.


Read More
Posted in Personal, Websites | No comments

Saturday, 1 October 2011

Looking for internship or job? Check Microsoft's Students to Business program

Posted on 20:41 by Unknown
Microsoft's Students to Business website connects graduating students with  Microsoft, Microsoft Partners and its customers. This program is open to graduating students in India. The enrollment process is simple and does not require any fees.

Microsoft's DreamSpark program gives students Microsoft professional tools at no charge.

For students passionate about software development, there are also other avenues where they can publish their original projects or contribute to ongoing open-source projects and get noticed. Here is a list of popular project hosting sites -

  • CodePlex
  • SourceForge
  • Google Code
  • CodeProject
Read More
Posted in Websites | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • 10 ways to make laptop battery last longer
    Paraphrased from a Right Choice magazine article with my own opinions: Keep the brightness of the screen as low as possible. If portability ...
  • Words that leave Google Instant speechless
    2600 Magazine has compiled a list of objectionable words that Google Instant has blacklisted. Several volunteers have submitted blackliste...
  • A new JavaScript Reference to bookmark
    For years, the JavaScript section at W3Schools.com has been a indispensable source of reference for me . It will now not be my only source. ...
  • Free JavaScript & jQuery learning resources
    There is a nice compilation of JavaScript & jQuery learning resources in this community wiki on StackOverflow.com . I picked those which...
  • Manipulate PDF files for free with PDFRider
    PDFRider (currently in version 0.5) is an open source project on Codeplex. This utility provides a GUI for the command-line program  Pdftk ...
  • Look what Google Goggles visual search can do
    Google Goggles is a visual search application available currently for Android powered phones. It may possibly be available for phones of oth...
  • HOW TO read long text messages on the Samsung Omnia 652
    Samsung Omnia 652 clumps text messages from a single recepient together. Scrolling through a message doesn't reveal the entire message ...
  • Web Applications - Tips & Tricks
    Did you know, you can append +any-word to a GMail address & use that word to filter emails or distinctly identify where the mail has co...
  • What is the difference between Browser Mode & Document Mode in IE
    If you're a web developer and your job actively involves building web pages that work the same in all browsers including the last three ...
  • Dig deeper into jQuery with "jQuery Succinctly"
    jQuery Succinctly by Cody Lindley is an ebook that Syncfusion is offering as a free download (requires registration). I've been working ...

Categories

  • AJAX
  • Android
  • APIs
  • App
  • ASP
  • ASP.NET
  • ASP.NET-MVC
  • Azure
  • Azure SQL Database
  • AzureInPictures
  • Bing
  • Book Review
  • Bookmarklet
  • Browsers
  • C#
  • chart
  • Chrome
  • Cloud
  • CSS
  • CSS3
  • DidYouKnow
  • E-Commerce
  • Excel
  • FB
  • Fiddler
  • Firefox
  • Gadgets
  • GeoLocation
  • GMail
  • Google
  • Google Docs
  • Google Reader
  • Health
  • Hotmail
  • HOWTO
  • HTML
  • HTML/CSS
  • HTML5
  • Humor
  • Hyderabad
  • IE
  • IIS
  • India
  • Internet
  • IT
  • Javascript
  • jQuery
  • JSON
  • JSONP
  • Laptop
  • Learning Resources
  • Lists
  • Map
  • Metrics
  • Microsoft
  • miscellaneous
  • Mobile
  • NAPA
  • Office365
  • Opera
  • PDF
  • Performance
  • Personal
  • PHP
  • PM
  • PowerShell
  • Privacy
  • Programming
  • Rant
  • Safari
  • Science
  • Search Engines
  • SearchEngines
  • Security
  • SEO
  • Sharepoint
  • SharePoint2013
  • Silverlight
  • Software Engineering
  • Solutions
  • SQL Azure
  • SQL Server
  • TFS
  • Tip
  • Tips
  • Tools
  • Tools/Utilities
  • Trivia
  • TWIL
  • Twitter
  • UX
  • VM
  • VS.NET
  • VS2010
  • VS2012
  • WCF
  • WebApps
  • Websites
  • WF
  • Windows Phone
  • Windows7
  • Windows8
  • Word
  • WP7
  • WPF

Blog Archive

  • ▼  2013 (112)
    • ▼  October (16)
      • 10 ways to make laptop battery last longer
      • Learnings in S/W Engineering from the HealthCare.g...
      • TWIL - Week #29
      • MS currently has 21 apps on Google Play, incl. Wor...
      • Review: uCertify PMI PMP v-5 Online PrepKit
      • TWIL - Week #28
      • HOW TO highlight a Province within a Country with ...
      • My first impressions of Nexus 7 tablet
      • Free APIs, online services to generate screenshots...
      • TWIL - Week #27
      • HOW TO prevent mixed content warning in web pages
      • What's common between Kovid Goyal & Antony Lewis?
      • TWIL - Week #26
      • FB & Twitter spam me with similar subject line
      • Book Review: PMP Rapid Review by Sean Whitaker; MS...
      • Windows Azure Mobile Services - Error: Table 'some...
    • ►  September (14)
    • ►  August (8)
    • ►  July (8)
    • ►  June (13)
    • ►  May (12)
    • ►  April (12)
    • ►  March (8)
    • ►  February (15)
    • ►  January (6)
  • ►  2012 (127)
    • ►  December (11)
    • ►  November (14)
    • ►  October (13)
    • ►  September (14)
    • ►  August (16)
    • ►  July (16)
    • ►  June (6)
    • ►  May (5)
    • ►  April (11)
    • ►  March (12)
    • ►  February (7)
    • ►  January (2)
  • ►  2011 (98)
    • ►  December (5)
    • ►  November (2)
    • ►  October (5)
    • ►  September (7)
    • ►  August (7)
    • ►  July (15)
    • ►  June (10)
    • ►  May (7)
    • ►  April (8)
    • ►  March (10)
    • ►  February (11)
    • ►  January (11)
  • ►  2010 (163)
    • ►  December (14)
    • ►  November (19)
    • ►  October (19)
    • ►  September (15)
    • ►  August (18)
    • ►  July (17)
    • ►  June (20)
    • ►  May (17)
    • ►  April (19)
    • ►  March (5)
Powered by Blogger.

About Me

Unknown
View my complete profile