Hello,
I am very new to PowerShell, and have been trying to write this script to display certain information about share drive troubleshooting. It is working how it want it to, BUT I am having a simple problem. My problem is this: When I run my $FPSenable variable
it will display the DisplayName,Enabled,Profile Properties (as it should), then when I go to run my $WinServices Varible, it will ONLY display the same Properties as $FPSenable (which are DisplayName,Enabled,Profile) , not the Properties associated with $WinServices
(which are Status,Name,DisplayName). I think the solution would be to STOP what ever variable I ran first, and then start a new Instance of the next variable I want to run next. I have no idea how to do that though. Any sort of guidance would be fantastic!
Code:
$FPSenable = Get-NetFirewallRule -DisplayGroup 'File and Printer Sharing'|Where Profile -eq Public | select DisplayName,Enabled,Profile
$WinServices = get-Service -name Browser,LanmanServer,Lanmanworkstation,NetTcpPortSharing | select Status,Name,Displayname
Clear-host
$msgToPerson ={
"##################################################################"
"############## Share Drive Troubleshooter #####################"
"##################################################################"
"Press 'a' to check if 'File and Printer Sharing' is Enabled"
"Press 'b' to check if the Correct services for Sharing are Running"
"Press 'q' to quit "
}
Do { #'Do' Start
$response = Read-host -Prompt $msgToPerson
if($response -eq 'a') {$FPSenable}
if($response -eq 'b') {$WinServices}
} until ($response -eq 'q') # 'Do' end