Hi
Is there a way we can search a specific word in web.config using powershell.
I have an entry of "user name" in the connection string. I want to find what the user name is and whether its a correct user name or not based on the criteria set in the script.
i believe its a simple matter of if statement but due to connection string i am unable to do this.
this is my connection string from web.config
<connectionStrings>
<add name="Membership" connectionString="Data Source=testdb;Initial Catalog=test;user
name=testUser;password=123456;MultipleActiveResultSets=true"
providerName="System.Data.SqlClient"/>
</connectionStrings>
My criteria is. if user name -eq testUser write-host "correct user name" else "user name is incorrect"
$webConfig = 'C:\Users\test\web.config'
$cfg = [xml](gc $webConfig)
Not sure how the if statement will work in searching the document and applying critera