Powershell ASP evaluation and configuration on Windows Vista

Am looking to web enable some Powershell scripts to ease usability for our dev and prod teams. One of the few ways to do this is to run Powershell ASP. I downloaded a trial copy of Powershell ASP and ran into a few glitches when doing an installation on a laptop running Windows Vista with IIS 7. The following steps were required to get the Demo application pages up and running without any errors.
1. Install IIS component on Windows Vista
2. Edit C:\Windows\System32\inetsrv\config\applicationHost.config and change Deny to Allow for the following line
section name=”handlers” overrideModeDefault=”Deny”
3. Run the following command as administrator from the command line
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -i
The output should be:
Start installing ASP.NET (4.0.30319).
…….
Finished installing ASP.NET (4.0.30319).
4. Install PowerShellASP.EXE
Be sure to leave the checkbox selected to: Create Virtual Folder On Default Web Server
5. Open Start -> Programs -> Powershell ASP v2 -> Demo Pages
6. The run link should now work for any of the Demos
Had originally received the following error before enabling <section name=”handlers” overrideModeDefault=”Allow” />
PowershellASP IIS7 handler error
There was an error while performing this operation.
Details:
Filename: \\?\C:\Program Files\PowerShellInside\Powershell ASP V2\www\web.config
Line number: 12
Error: This configuration section cannot be used at this path. This happens when the section is locked at the parent level. Locking is either by default (overrideModeDefault=”Deny”), or set explicitly by a location tag with overrideMode=”Deny” or the legacy allowOverride=”false”.

New Windows 8 User Interface

Derek Seaman just posted a link to a video on YouTube where Jensen Harris talks about the new Windows 8 user interface. I’m reposting the video since it’s a nice demonstration of HTML 5 and JavaScript. As a long term project I’m looking to convert a Powershell .NET Winform app to a web based application. HTML 5 might be the way to go.

Link to ZDNET article with list of new Windows 8 features.

10,000 lines of Powershell later

Windows Powershell is just too cool. If you don’t know what Powershell is and your on a Windows Computer turn on your speakers and do this:

Click Start -> Run
Type powershell
Press Enter
Copy and Paste the following into the window and then press Enter

$webclient = new-object system.net.webclient
$url = “http://weather.noaa.gov/pub/data/forecasts/zone/md/mdz010.txt”
$weather = $webclient.downloadstring($url)
$weather = $weather -replace “\.”,” ”
$weather = $weather -replace “S  “,”s ”
$weather = $weather -replace “WINDS”,”WENDS”
$weather = $weather -replace “\$”,”"
$weather = $weather -replace “highs”,”high”
$forecast += $weather -split “`n”
$forecast = $forecast | select-object -skip 11 | select-object -first 30
$voice = new-object -com SAPI.SpVoice
$voice.rate = -2
$voice.Speak($forecast, 1)

You can find your local forecast here. If your a bit creative you can replace the $url text file value with your own area forecast.

VMware and BF2 x4

I have not tried  running any PC games in a VMware virtual machine yet, but seems this guy can get 4 copies of Battle Field 2 running on one PC. This could conceivably open a whole new realm of possibilities for multi-boxing characters in different games.

Would save a guy from having to pay the bill to power all of these:

PowerCLI + VMware vSphere Hardening

Some work has already been done to automate the scanning and mitigation of security vulnerabilities in a vSphere environment via PowerShell. However Luc’s fine script is a bit limited in scope. I’ve been hacking out a full blown scan and harden script via Powershell + PowerCLI and it’s wrapped around some functions already written to generate a cleanly formatted HTML report (Special thanks to Virtu-Al). Many vSphere enthusiasts have already written functions that mitigate vulnerabilities listed in the recent vSphere 4. 0 Hardening Guide. Having both of the scripts above easily allows the extending of functions to check for not only virtual machine, but ESX and vCenter misconfiguration.

Powershell 2.0 along with the PowerCLI cmdlet extensions is quite amazing. I’ve found a simple clone backup script here, and provisioning script here. The list goes on and on. With all of this new found Powershell knowledge I hope to someday find some way to give back to the large online community that has made my life so much easier. Take your development and administration of vSphere to a whole new level by checking out PowerCLI. Happy Scripting.

Partition large windows disks

Solved a problem creating a 15TB partition in Windows 2003 on an equallogic iSCSI storage array. When creating the partition in windows with the disk management tool at the new simple volume wizard window be sure to select the appropriate cluster size that will support the partition size.  Selecting 4096 (4k) supports up to 16TB. The default for us using the tool limited us to the 2TB limit. The option to convert to GPT was grayed out. When we selected 4k as a cluster size the disk is automatically converted to GPT.

Ref:  Default cluster size for NTFS, FAT, and exFAT

iPhone OS 4.0 Update

iPhone OS 4.0 just released and now has multitasking (sort of). So I jump on the laptop download the latest iTunes update and watched the status bar in anticipation as I tried to apply the new OS to my iPhone. The iPhone OS update failed and I am prompted to restore the iPhone which also fails with an error code of 37. There is an option to view the update log and I notice several errors (bits snipped from the log)

2010-06-23 06:37:18.972 [3052:524]: unable to open device_map.txt: No such file or directory

void AppleUSBDeviceMux::handleConnectResult(BulkUSBMuxSession*, errno_t) new session to port 12345 failed: 61
void AppleUSBDeviceMux::handleConnectResult(BulkUSBMuxSession*, errno_t) new session to port 12345 failed: 61

AppleBCMWLAN::handleIOKitBusyWatchdogTimeout(): Error, no successful firmware download after 60000 ms!! Giving up…

disk0s2s1: ioctl(_IOW,’d',24,4) is unsupported.

2010-06-23 06:40:53.028 [3052:ddc]: <Restore Device 06C11C20>: Restore failed (result = 37)
2010-06-23 06:40:53.113 [3052:d84]: iTunes: Restore error 37

Quick search on the net yields some fixes.

One fix is to delete and redownload the update file (My laptop is running Vista btw) C:\Users\<username>\AppData\Roaming\Apple Computer\iTunes\iPhone Software Updates\iPhone2,1_4.0_8A293_Restore

This didn’t work and I really wanted to avoid uninstalling iTunes altogether which is another suggested fix. I had another PC to try and it had a really old version of iTunes. I remembered that I skipped updating Safari on my laptop so I decided to update Safari too along with the new iTunes version. I had previously allowed all of the Apple services through the firewall and decided to shut that down as well just for the iPhone update (probably unnecessary).

The update worked on the PC and am now able to sync back all of my stuff through iTunes on my laptop.

What was the root problem/fix? Possibly the old Safari 4.0 version, or maybe just reinstalling all of iTunes + Safari to latest versions. Some people also reported having problems contacting Apple’s servers because of the overload and just retrying the update several times. At any rate Good Luck with your updates!

VMware Data Recovery Demo

VMware Data Recovery provides a centralized management interface to enable backup and recovery of your VMs directly through VMware vCenter Server.

  • The entire inventory of VMs are automatically identified through VMware vCenter Server
  • Uses an intuitive wizard driven workflow to create, configure and schedule backup jobs
  • Multiple restore points for each VM are displayed to easily select a specific point in time copy to restore
  • Automatically monitors VMs that are moved by VMware HA, VMware VMotion and VMware DRS, so scheduled backups continue uninterrupted

Symantec Backup Exec for Windows Intelligent Disaster Recovery (IDR) restore problem

Doing some testing of Symantec Backup Exec 12.5 Intelligent Disaster Recovery (IDR). During the IDR restore process you boot the server from a custom built IDR CD. I selected the automated option during the restore process and received the following error just after entering in the authentication information:

“Error category  : Security ErrorsError: e000fe29 – Authentication failed on connection to the server. Make sure that the user account has the appropriate permissions and that the password was typed correctly.
For additional information regarding this error refer to link V-79-57344-65065″

For the fix go to your media servers

Backup Exec -> Tools -> Options ->Network and Security

Select the checkbox for, “Enable remote agent TCP dynamic port range”

VMware View (VDI) failed to authenticate to View Administrator

Had a problem logging into the VDI adminstration webpage after doing the initial installation of VDI 3.1. The VDI logs are kept in C:\Documents and Settings\All Users\Application Data\VMware\VDM\logs. In the file I kept seeing these errors:

WARN  <MessageFrameWorkDispatch> [ws_winauth] LogonUser FAILED, error=1326 (Logon failure: unknown user name or bad password.)
INFO  <TP-Processor3> [LoginBean] User administrator has failed to authenticate to View Administrator

I knew the password was right and that the administrator was setup correctly for authentication. I then tried to login to the view server with domain credentials. I then got this separate error:

The system cannot log you on due to the following error:
The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain.
Please try again or consult your system administrator.

I had created the VDI server by copying my domain controllers VM folder and just registering it on the ESX host. This meant both VMs had the same SID which caused the root problem. One remedy is running newsid which will generate another SID on the copied VM server. Leave the domain and login to the local server before running newsid on the copied VM. Then rejoin the domain. Credit to SysInternals & GWB for the solution.