PowerShell for Windows Admins


September 3, 2012  2:05 PM

New PowerShell site

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

If you haven’t found it already I would recommend you visit powershell.org at http://powershell.org/wp/home/.

Its a new location for getting answers to your PowerShell questions.

You will probably recognise some of the people moderating the forums there – Don Jones, Jeff Hicks, Kirk Munro & me among others.

Highly recommended as a PowerShell forum

September 2, 2012  12:43 PM

Windows 8 RTM startup

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

I was looking at Win32_OperatingSystem today and noticed that the last boot up time wasn’t right

PS> Get-CimInstance -ClassName Win32_OperatingSystem | select LastBootUpTime

LastBootUpTime
————–
17/08/2012 10:02:11

17 August isn’t right as I know I did a cold start this morning – or at least I think I did!

Windows 8 starts up much faster than Windows 7

Looking at the System event log the last but one entry last night was event id 64 – “The system is entering sleep.”

Looks like using the Shutdown option from Settings – Power only puts the machine to sleep.

I tried using the PowerShell stop-computer cmdlet.

Shutdown took longer than usual. 

I found an entry in the system log stating

“The kernel power manager has initiated a shutdown transition.”

Startup then took much longer than usual

PS> Get-CimInstance -ClassName Win32_OperatingSystem | select LastBootUpTime

LastBootUpTime
————–
02/09/2012 19:27:41

So looks like use the Settings – Power – Shutdown option to put the machine into a deep sleep and get very quick start up.  Use stop-computer and completely shutdown but have longer startup times.

Question now is does the deep sleep put any drain on the battery for laptops? I’ll try and find out.


August 25, 2012  5:11 AM

Windows 8 tip: 1 Weather app

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

The Windows 8 start screen has a nice looking app to display the weather.

You can search for towns and cities to add to the display. My home town (or even the nearest big town) doesn’t show in the results returned by the search. The nearest town I can find is 50 miles away. In England that can be a whole different weather pattern.

On a whim I tried searching for my post code – came up with the correct village and displays.

US zip codes also seem to work.  Haven’t tried for any other countries so can’t guarantee results


August 25, 2012  2:06 AM

Windows 8 Networking cmdlets

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Windows 8 brings PowerShell v3 and a whole bunch of PowerShell modules.  One such module is NETTCPIP and as the name suggests is about networking.

PowerShell v3 automatically loads modules for you so as soon as PowerShell opens try

PS> Get-NetIPConfiguration

InterfaceAlias       : Ethernet
InterfaceIndex       : 13
InterfaceDescription : NVIDIA nForce 10/100/1000 Mbps Ethernet
NetProfile.Name      : Unidentified network
IPv4Address          : 10.10.54.202
IPv6DefaultGateway   :
IPv4DefaultGateway   :
DNSServer            : fec0:0:0:ffff::1
                       fec0:0:0:ffff::2
                       fec0:0:0:ffff::3

InterfaceAlias       : WiFi
InterfaceIndex       : 12
InterfaceDescription : Qualcomm Atheros AR5007 802.11b/g WiFi Ada
NetProfile.Name      : TiscaliF23E11
IPv4Address          : 192.168.1.2
IPv6DefaultGateway   :
IPv4DefaultGateway   : 192.168.1.1
DNSServer            : 192.168.1.1

InterfaceAlias       : Bluetooth Network Connection
InterfaceIndex       : 30
InterfaceDescription : Bluetooth Device (Personal Area Network)
NetAdapter.Status    : Disconnected

One thing that you will need to do is to set up PowerShell remoting

PS> Enable-PSRemoting

WinRM Quick Configuration
Running command "Set-WSManQuickConfig" to enable remote management of this computer by using the Windows Remote
Management (WinRM) service.
This includes:
    1. Starting or restarting (if already started) the WinRM service
    2. Setting the WinRM service startup type to Automatic
    3. Creating a listener to accept requests on any IP address
    4. Enabling Windows Firewall inbound rule exceptions for WS-Management traffic (for http only).

Do you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a

Set-WSManQuickConfig : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150859113"
Machine="localhost"><f:Message><f:ProviderFault provider="Config provider"
path="%systemroot%\system32\WsmSvc.dll"><f:WSManFault xmlns:f="
http://schemas.microsoft.com/wbem/wsman/1/wsmanfault"
Code="2150859113" Machine="RSLAPTOP01"><f:Message>WinRM firewall exception will not work since one of the network
connection types on this machine is set to Public. Change the network connection type to either Domain or Private and
try again. </f:Message></f:WSManFault></f:ProviderFault></f:Message></f:WSManFault>
At line:69 char:17
+                 Set-WSManQuickConfig -force
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

The emphasis of Public is mine. We have a network connection type set to public. At this point I would normally be tearing my hair out because network connection types are the ultimate pain to modify. I have hated the things since Windows Vista. No more they are now a minor inconvenience.

Look in the module NetConnection for Get-NetConnectionProfile

PS> Get-NetConnectionProfile

Name             : Unidentified network
InterfaceAlias   : Ethernet
InterfaceIndex   : 13
NetworkCategory  : Public
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Name             : TiscaliF23E11
InterfaceAlias   : WiFi
InterfaceIndex   : 12
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

Now we can get to it modifying is easy

PS> Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private
PS> Get-NetConnectionProfile

Name             : Unidentified network
InterfaceAlias   : Ethernet
InterfaceIndex   : 13
NetworkCategory  : Private
IPv4Connectivity : NoTraffic
IPv6Connectivity : NoTraffic

Name             : TiscaliF23E11
InterfaceAlias   : WiFi
InterfaceIndex   : 12
NetworkCategory  : Private
IPv4Connectivity : Internet
IPv6Connectivity : NoTraffic

And now you can enable PowerShell remoting

Best of all the change is WMI based.  The netconnection cmdlets are created as CDXML from WMI classes new to Windows 8. Get-NetIPConfiguration is also CDXML.

CDXML is cmdlets over objects – WMI classes wrapped in XML and presented as a module

see Chapters 18 & 19 of PowerShell and WMI for more details


August 21, 2012  2:09 PM

Windows 8 upgrade experience: #1

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

I’ve upgraded two machines to Windows 8

The first is my main working laptop:

  • Windows 8 Enterprise can’t do an in place upgrade of Windows 7 Ultimate. So had to re-install all my applications. Took the opportunity to upgrade to Office 2013 and Visual Studio 2012
  • Following installed and work:
    • Adobe Digital Editions
    • Camtasia
    • Snaggit
    • Live mail 2012
    • Palm eReader
    • Skype
  • Magic Disk is no longer required because Windows 8 can mount .iso files in the file system.  Right click an .iso file in File Explorer and Mount is the first choice on the context menu
  • Windows defender now does Anti-Virus

 

The second machine was my Dell Duo:

  • Installed windows 8 as an upgrade to Windows 7 Home premium
  • Kindle for PCs doesn’t work on Windows 8. Download the free Kindle app from the Microsoft  store. Its not obvious where the downloaded books are stored
  • The DUO is a hybrid netbook/tablet. The accelerometer stopped working post upgrade meaning the screen didn’t rotate. Not good for a tablet. Dell don’t appear to do an updated driver but a web search found the issue was fixable using the Samsung driver from http://www.samsung.com/global/windowspreview/
  • Running as a tablet swipe & touch all seem to work OK

One draw back to the Kindle app is that it only seems able to access ebooks through the Amazon store. With Kindle for windows PC I could add books in from other sources. Stopping this is a backward step.  Luckily I have other means of reading those ebooks


August 19, 2012  2:38 AM

PowerShell v3 goodness

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Downloaded and installed PowerShell v3 and its associated new operating system (Windows 8) from MSDN in the week.

One nice new cmdlet is Unblock-File.

Download a bunch of files from the Internet and you have to unblock them.  Its now this easy

Get-ChildItem -Filter *.d* | Unblock-File


July 28, 2012  3:02 AM

UK PowerShell Group session–31 July 2012 *** CANCELLED

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Next weeks session

http://msmvps.com/blogs/richardsiddaway/archive/2012/07/11/uk-powershell-group-session-31-july-2012.aspx

is CANCELLED due to illness.

I’ll reschedule for late August / early September


July 12, 2012  12:21 PM

PowerShell in Depth Offer

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Would you like a copy of PowerShell in Depth signed by the authors plus a DVD narrated by the authors demoing many of the concepts in the booK? Oh and the book is signed by all three authors and is parted of a limited edition?

You would?

Then visit

http://store.concentratedtech.com/indepth.php

 

Soon.

Its a limited one off offer & when they’re gone – they’re gone


July 11, 2012  12:28 PM

UK PowerShell Group session–31 July 2012

Richard Siddaway Richard Siddaway Profile: Richard Siddaway


When: Tuesday, Jul 31, 2012 7:30 PM (BST)


Where: Virtual

*~*~*~*~*~*~*~*~*~*

Workflow is one of the big new features in PowerShell v3. This session introduces how it works and some of the quirks associated with this new technology

Notes


Richard Siddaway has invited you to attend an online meeting using Live Meeting.
Join the meeting.
Audio Information
Computer Audio
To use computer audio, you need speakers and microphone, or a headset.
First Time Users:
To save time before the meeting, check your system to make sure it is ready to use Microsoft Office Live Meeting.
Troubleshooting
Unable to join the meeting? Follow these steps:

  1. Copy this address and paste it into your web browser:
    https://www.livemeeting.com/cc/usergroups/join
  2. Copy and paste the required information:
    Meeting ID: 25FWNB
    Entry Code: m#@)”)~3M
    Location: https://www.livemeeting.com/cc/usergroups

If you still cannot enter the meeting, contact support

Notice
Microsoft Office Live Meeting can be used to record meetings. By participating in this meeting, you agree that your communications may be monitored or recorded at any time during the meeting.


July 5, 2012  1:08 PM

PowerShell and XenDesktop recording

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

The recording from last nights PowerShell group session – PowerShell and XenDesktop is available from

https://skydrive.live.com/?sc=documents&cid=43cfa46a74cf3e96#cid=43CFA46A74CF3E96&id=43CFA46A74CF3E96%212968&sc=documents

 

The slides and demo are available from

http://www.jonathanmedd.net/2012/07/slides-from-powershell-and-xendesktop-5-session-at-the-uk-powershell-usergroup.html

 

Enjoy


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: