?
Solved

Need a Powershell script to change css code

Posted on 2014-07-09
5
Medium Priority
?
474 Views
Last Modified: 2014-07-16
Hi Experts,

I'm quiet new to PowerShell scripting. What I need is the following;

I've got a simple HTML / CSS website. The site shows some computer icons that users can click on to start a RDP session to a workstation. Below each icon I want the network status of that specific workstation shown.

So the script needs to ping the workstations from, for example a txt file with a list of ip addresses, and then show the text 'online' or 'offline' below the icons of that workstations. The background color must be green or red.

Can I build a css file that creates a class for every PC that's in the list in the txt file?  I know I asked this here before, but I haven't found a good solution yet.
0
Comment
Question by:SvenIA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 2000 total points
ID: 40184646
I don't this this will ever work properly mate...

If I well understand you you want to change the CSS to reflect the servers status instead of doing it server-side right?
The main problem I see here is actually related with the browsers cache.
If the name of the CSS file doesn't change, the browser won't download it again, sometime not even with a Ctrl-F5 (IE is a bit unstable on this and Opera you can well forget about it).
So, even if you change the CSS file the browser won't pick it or you'll never be 100% sure if he picked it or not.

Your most reliable way to implement this is server side or client-side with AJAX calls and timers.
0
 
LVL 7

Author Comment

by:SvenIA
ID: 40184669
That's a good one, didn't think of that.
0
 
LVL 7

Author Comment

by:SvenIA
ID: 40184729
Is it possible to refresh an IE browser window periodically with Powershell?
0
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 40184746
I don't know but It won't make much difference anyway mate.
You can't neither easily nor reliably control the way browsers reload their resources upon refresh.

Sure there are a lot of tricks, but they usually involve more than a mere Ctrl-F5.
Without changing the HTML of the page I would say it's impossible.

For instance, you can add some "special" tags to the page header to disable browsers cache:
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

Open in new window

But this will impact the whole website resources caching which probably you don't want and still... if that thing you want to do is really important I wouldn't trust this "hack" myself.

Is it really out of the question to do it server-side?
0
 
LVL 7

Author Closing Comment

by:SvenIA
ID: 40198910
Thanks for the information!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question