String error

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 14 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
antknee
Posts: 35
Last visit: Wed Jan 05, 2011 10:44 pm

String error

Post by antknee »

I am trying to get this script working. It seems simple but I keep getting an error that reads:encountered end of line while processing a string token.POSITION:At line:16 char:2+ }I have no idea what that means.... uploads/24068/GetService.txtBasically I just want it to ping the computers, if they are online, check if the Firewall service is running. If not online, skip the computer. Thanks
User avatar
antknee
Posts: 35
Last visit: Wed Jan 05, 2011 10:44 pm

String error

Post by antknee »

I am trying to get this script working. It seems simple but I keep getting an error that reads:encountered end of line while processing a string token.POSITION:At line:16 char:2+ }I have no idea what that means.... uploads/24068/GetService.txtBasically I just want it to ping the computers, if they are online, check if the Firewall service is running. If not online, skip the computer. Thanks
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

String error

Post by jvierra »

Probably this:
write-host $comp is OFFLINE -background "RED" -foreground "BLACk"
Should be this:
write-host "$comp is OFFLINE" -background RED -foreground BLACk
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

String error

Post by jvierra »

And I was dumb enough to see it quickly.
This topic is 14 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked