Controoling IIS using Powerhshell



  • 1. Powercell typecast _comObject to .Net
    I am running below code - [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Interop.Excel") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Core") [Microsoft.Office.Interop.Excel.Application]$xl = new-object Microsoft.Office.Interop.Excel.ApplicationClass $file="D:\test\test.csv" $xl.visible = $true $wbk = $xl.Workbooks.Open("$file") $wks = $wbk.worksheets.item(1) $r1=[Microsoft.Office.Interop.Excel.IRange]$wks.Range("A1:A1") #Commented code #$r2=[Microsoft.Office.Interop.Excel.IRange]$wks.Range("A2:A2") #$mis = [System.Reflection.Missing]::Value; #$xl.Union($r5, $r6, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis, $mis) ............. It throws below error while I try to typecast _ComObject returned to IRange (To run the script, just create a new Excel file and save it to .csv format D:\test\test.csv) Error message - $r1=[Microsoft.Office.Interop.Excel.IRange]$wks.Range <<<< ("A1:D1") + CategoryInfo : NotSpecified: (:) [], RuntimeException + FullyQualifiedErrorId : RuntimeException Typecasting is required otherwise the next command to union two range (commented code) fails with same error. I am stuck on it. Please advice.
  • 2. Remote session from Win 7 to XP?!?
    Hi Folks, I have here Windows 7 (Business Edition) and XP SP3 (Professional) machines. Both system have PowerShell 2.0 installed and stay in the same Domain. On W7 it runs the build 7600 on the XP runs the build 6002. It's no problem to start a remote session from XP to W7 and from XP to XP but if I try to start a remote session from W 7 to XP the remote server always reject the connection. Any idea about this problem? THX Andre
  • 3. append pre-fix
    I've a list of names in a text file: a001 b002 c003 etc I want to prefix it with GC-. Therefore results become GC-A001 GC-B002 GC-C003 ETC
  • 4. eject, remove USB, flash or other drives
    Is there a way we can remove this devices from powershell? -- Michael Soza Estudiante Ingenier Civil Informica Universidad de Concepci

Controoling IIS using Powerhshell

Postby aG93IHRvIGRpc3BsYXkgdmFyaWFibGUgdmFsdWU/ » Fri, 05 Sep 2008 20:26:00 GMT


I have installed IIS 7 on windows vista and now I want to learn automating 
IIS services using Powershell. So what I need to do for this ? Do I need 
install anything else bcoz the commands for accessing IIs thru Powershell 
doesn't seem to work in the current Powershell enviroment.

Re: Controoling IIS using Powerhshell

Postby Marco Shaw [MVP] » Fri, 05 Sep 2008 21:28:52 GMT



*Microsoft MVP - Windows Server - Admin Frameworks
*PowerShell Co-Community Director -  http://www.**--****.com/ 
*Blog -  http://www.**--****.com/ 

Re: Controoling IIS using Powerhshell

Postby UmljaFMgW01WUF0 » Mon, 08 Sep 2008 22:03:01 GMT

There are a few ways to work with IIS 7 and PowerShell.  The provider that 
Marco mentioned is one but there is also .NET managed code via 
Microsoft.Web.Administration and WMI which are both available when IIS 7 is 

The pros and cons of the various methods are summarised 
 http://www.**--****.com/ !43CFA46A74CF3E96!1584

The comment regarding Microsoft.Web.Administration being usable remotely is 
slightly misleading as there are issues with credentials and that technique 
is more suited to workgroups where you have the same account on both machines.

There are examples of most of the techniques on my blog - are you interested 
in any one technique in particular
Richard Siddaway
All scripts are supplied "as is" and with no warranty 
PowerShell MVP
Blog:  http://www.**--****.com/ 
PowerShell User Group:  http://www.**--****.com/ 

Similar Threads:

1.Problems clustering IIS using NLB, DFS, and FRS and using FrontPage server extensions


I am attempting to cluster our web site using NLB for load-balancing and 
reliability as well as using DFS with FRS to automatically synchronize any 
changes made to the content.  We use the FrontPage extensions, and this is 
where the catch is.

I have started by configuring the two web servers using the steps in the 
article entitled "Connecting Web Sites to UNC Network Shares."  On the first 
server, the FrontPage extensions appear to work fine and I am able to set 
permissions properly.

When I configure the second server to synchronize with the first server's 
content and change the web site to use the DFS share, it can recognize the 
FrontPage structure, but is not able to see the permissions properly.

At the folder/file level, all of the permissions look identical to the first 
server, so I am confused as to why the second server is unable to see this. 
Obviously, this will cause problems when attempting to access and modify 
content using FrontPage.

Other than the article I mentioned previously, I can't find any 
easy-to-follow, step-by-step instructions on how to cluster IIS using this 
combination of NLB, DFS, FRS, and FrontPage extensions, so I wonder if I am 
just missing something.

Can anyone point me in the right direction?

We are using IIS 6.0.

Thank you very much for your help!


2.Frontpage extensions on IIS 6.0 and using Frontpage 2003

I have installed a 2003 server with IIS 6.0 running. I access it with 
Frontpage 2003 when I try to administer the extensions I get the following 
message "  The server administration programs and the server extensions on 
the web server are not compatible. The administration program is too old to 
use with this server. " This was installed from the same Server 2003 disk

3.Problems publishing to the Localhost using IIS 5.1 & FP 2002 extensions

4.Problems publishing to the Localhost using IIS 5.1 & FP 2002 extensions (0/1)

5.Problems publishing to the Localhost using IIS 5.1 & FP 2002 extensions (0/1) (0/1)

6. Trying to publish to localhost using iis, but "Microsoft SharePoint Administrator" isn't available

7. Using search form created by Frontpage on IIS 6.0 returns HTTP

8. Intalling Frontpage extensions on IIS using a script.

Return to powershell


Who is online

Users browsing this forum: No registered users and 67 guest