.NET Framework - Formatting output with write-host

Asked By Vedran Matica
13-Sep-07 04:35 PM
Hello,


I have a problem using write-host cmdlet.
Here's the line that I'm using to display FQDN of a computer:

write-host "Fully Qualified Domain Name: " $strCompName.ToLower() "."
$strPrimaryDomain`n

And I receive:
Fully Qualified Domain Name:  xp-comp . test.local

I want to avoid space between computername, dot and a domain name.

How can I achieve it? I realize that ampersand is not required to
concatenate items in PS.

Thanks a lot in advance.

BR,
Vedran
StrCompName.ToLower
(1)
StrPrimaryDomain
(1)
Guys
(1)
Test.local
(1)
  Kiron replied...
13-Sep-07 04:43 PM
Try:

write-host "Fully Qualified Domain Name:=20
$($strCompName.ToLower()).$strPrimaryDomain`n"

--=20
Kiron=20
  Vedran Matica replied...
13-Sep-07 04:47 PM
I have just realized that I can use -separator parameter with an empty
string. :-)
  Brandon Shell replied...
13-Sep-07 04:38 PM
Try this
write-host "Fully Qualified Domain Name:
$($strCompName.ToLower()).$($strPrimaryDomain)"
or
write-host ("Fully Qualified Domain Name: {0}.{1}" -f
$strCompName.ToLower(),$strPrimaryDomain)
  Vedran Matica replied...
13-Sep-07 04:52 PM
Guys, thanks. You have a really good response time. :-)

And the best thing is that the same thing can be accomplished in various
ways.


Vedran
Create New Account
help
on Internet and in past for this kind of information mainly newsgroups (currently forums), where guys like Tom, Jason and Armin showing to write from knowledge. Do you think why newsgroups many persons, who live all over the world and some of those, especially the marketing guys take words, which sounds elite for them to use, but they probably never will understand what they wrote. They get them from those developer guys who like that jargon to put them on a more elite place. All my life many persons, who live all over the world and some of those, especially the marketing guys take words, which sounds elite for them to use, but they probably never will understand what they wrote. They get them from those developer guys who like that jargon to put them on a more elite place. All my life many persons, who live all over the world and some of those, especially | the marketing guys take words, which sounds elite for them to use, but they | probably never will understand what they wrote. | | They get them from those developer guys who like that jargon to put them on | a more elite place. All my life me are teachers, who have that as only profession, often almost an equivalent of marketing guys. Just my opinion. Cor Cor, you misunderstand - I was not commenting on your knowledge at
server's) to reference dotnet framework beyond 2.0 - things on the website in my test (local) environment and the production environment - should function as before. Right? ;-) BC re: !> as long as server's) to reference dotnet !> framework beyond 2.0 - things on the website in my test (local) environment !> and the production environment - should function as before. !> Right? Right. Juan T. Llibre, asp
Name -sAMAccountName $_.sAMAccountName -UserPrincipalName $_.UPN -database "EXC01 \ SCCCS \ SCCCS Database" -Password $Password -OrganizationalUnit "test.local / SCC" -ResetPasswordOnNextLogon:$true } At the moment, I have to manually type in the password before _.sAMAccountName -UserPrincipalName $_.UPN JC> -database "EXC01 \ SCCCS \ SCCCS Database" -Password $Password JC> -OrganizationalUnit "test.local / SCC" -ResetPasswordOnNextLogon:$true JC> } JC> JC> At the moment, I have to manually type in
xmlBuffer) 'SO mq = 3D New MQClient("SYSTEM.DEF.SVRCONN / TCP / 182.188.888.889(1414)", "TEST", "LOCAL.QUEUE.TEST.TTT.QUEUE", 'mq.MessagePersitence = 3D mqMessagePersitence mq.CreateManager() mq.CreateQueuePut() mq.PutMessage() 'SO
run every time, or I have extended beyond the unit (a unit test should only test local code, with mocks / dependency injection for outside code). But, I am always external. My norm