Hi all,

I've written a script to speed up the creation of web apps which takes user 
prompts and passes all the values to a string variable like so...

# Create WebApp [options]
$createApp = "-Name $name " +
            "-Port $port " +
            "-HostHeader $url " +
            "-URL '$publicUrl' " +
            "-Path $path " +
            $appPool +
            "-AuthenticationMethod $authMethod " +
            "-DatabaseServer $dbServer " +
            "-DatabaseName $dbName" +
            $anon +
            $ssl

# Instantiate Claims provider
$ap = New-SPAuthenticationProvider

I then pass $createApp and $app to a new variable.

$command = "New-SPWebApplication $createApp -AuthenticationProvider $ap -WhatIf"

Before finally invoking it.

Invoke-Expression $command

The output of $command is below. Now if I copy/paste that output at the command 
prompt and run it, it works as expected.

New-SPWebApplication
-Name Dev
-Port 80 -HostHeader dev.local.com.au
-URL https://dev.local.com.au
-Path C:\inetpub\wwwroot\wss\VirtualDirectories\devlocal80
-ApplicationPool Portal
-AuthenticationMethod Kerberos
-DatabaseServer dev-sql
-DatabaseName CONTENT_Dev
-SecureSocketsLayer
-AuthenticationProvider $ap

But when it's invoked I get an error with the creation of the authentication 
provider.

New-SPWebApplication : A valid object could not be read from the provided 
pipebind parameter.
At line:1 char:1
+ New-SPWebApplication -Name DEV -Port 80 -HostHeader dev.local.com ...
+ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: 
(Microsoft.Share...viderPipeBind[]:SPAuthenticationProviderPipeBind[]) [New-SPW
   ebApplication], PSArgumentException

Removing AuthenticationProvider $ap results in the creation of a classic mode 
web app.

I can understand why this is occurring but am hoping someone has an easy fix 
for it... Maybe a better method to pass it in?

Regards,

Paul

The content of this email is confidential to the intended recipient at the 
email address to which it has been addressed. It may not be disclosed to, or 
used by, anyone other than this addressee, nor may it be copied in any way. If 
received in error, please contact the author and then delete the message from 
your system. 
Please note that neither Keller Australia nor the sender accepts any 
responsibility for viruses and it is your responsibility to scan the email and 
attachments (if any).
Visit http://www.keller.com.au/ for more information. 

--------------------------------------------------------------------------------
This e-mail message has been scanned for Viruses and Content and cleared by 
MailMarshal 
--------------------------------------------------------------------------------
_______________________________________________
Sponsored by Infotext - Amazing Search for Microsoft SharePoint - 
http://www.infotext.com/
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to