Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Guys help with the usage of Get-member

$
0
0

I have a if loop I’m using

if (($Product -eq 'WebApp' ) -and !(((Get-WebApplication -Name "WebApp").PhysicalPath) -eq $null)) { do-something } else { write-host 'do something else' } 

Issue is, I’m getting errors

“The property ‘PhysicalPath’ cannot be found on this object. Verify that the property exists.”

Now, I know it doesn’t exist yet. All I want to do is to check the existence of the web app. If it doesn’t exist, then it should run the else statement. If it does, then it runs the if statement.

Please guys, how can I accomplish this without getting the error above when the webapp is not installed?

Look forward to your responses.

Thanks

submitted by /u/Mike_Newbie
[link] [comments]

The post Guys help with the usage of Get-member appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles