Found that if I use: New-SPWebApplication -Name ("{0}" -f $webApp.Name) -HostHeader that because it converts the XmlAttribute to a string, it seems to delimits the string variable automatically (happy days!), so I dont need to delimit at all. Many thanks
Date: Mon, 9 Jan 2012 20:09:10 +1000 From: tmcgee...@gmail.com To: ozmoss@ozmoss.com Subject: Re: Powershell frustration.... Alternatively, delimiting the value with quotes might work: e.g. New-SPWebApplication -Name ('"{0}"' -f $webApp.Name) -HostHeader .... etc On 9/01/2012 6:51 PM, Tony McGee wrote: I think you just want to put it into single quotes? Double quotes will expand the $webApp variable, single quotes won't. e.g. New-SPWebApplication -Name '$webApp.Name' -HostHeader .... etc Cheers, Tony On 9/01/2012 4:55 PM, Nigel Witherdin wrote: Hey All, An easy one Im sure, but I havent been able to come up with the right google search string to fine the answer myself.... I am writing a script that parses an XML file and creates web app, site coll, content db etc. based on the xml. All works ok, except when people put spaces into names (like web app name or app pool name, etc. - damn users!). So what ends up in my script is something like: New-SPWebApplication -Name $webApp.Name -HostHeader ..... etc. I need some way of delimiting the variable $webApp.Name but still resolving it to its value (not its type, which is what happens when you simply put: -Name "$webApp.Name" in the command). Really frustrating as I know I have already figured this out before, but cant find the script I had it in, so am not sure what I did for it (grrr) Thanks Nigel _______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss _______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
_______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss