Scipt to test svc status on multiple computers output to html and refresh

script to:
1) test net logon svc on multiple computers
2) output results to html iframe  for computers where service is not running
3) be able to have the script update every 30 seconds

Hi,
Here's a bunch of examples that you can use to build from:
Get-Content .\computerList.txt | ForEach-Object {
Write-Output "Computername is $_"
Get-Content .\computerList.txt | ForEach-Object {
If (Test-Connection -ComputerName $_ -Count 1 -Quiet) {
Write-Output "$_ is up"
} Else {
Write-Output "$_ is down"
Get-Content .\computerList.txt | ForEach-Object {
$serviceState = Get-Service -Name Netlogon -ComputerName $_
If ($serviceState.Status -eq 'Running') {
Write-Output 'Service is running'
} Else {
Write-Output 'Service is not running'
Get-Content .\computerList.txt | ForEach-Object {
Get-Service -Name Netlogon -ComputerName $_ |
Select-Object MachineName,Name,Status
} | ConvertTo-Html | Out-File .\serviceStatus.html
$count = 0
Do {
Write-Output $count
$count++
Start-Sleep -Seconds 30
} Until ( $count -eq 10 )
Do {
Write-Output "This loop doesn't end. You'll need to press CTRL+C to stop this."
Start-Sleep -Seconds 30
} While ($true)
Links to some documentation with additional explanation and examples:
http://ss64.com/ps/get-content.html
http://ss64.com/ps/convertto-html.html
http://ss64.com/ps/test-connection.html
http://ss64.com/ps/foreach-object.html
http://ss64.com/ps/if.html
http://ss64.com/ps/out-file.html
http://ss64.com/ps/get-service.html
http://ss64.com/ps/write-output.html
http://ss64.com/ps/do.html
http://ss64.com/ps/select-object.html
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing)

Similar Messages

  • ARD won't save multiple computers with same IP and different port!

    I'm trying to access multiple computers over the internet behind a firewall with port forwarding.
    I can access each computer, but ARD won't save the IP address and port (in IP Address column of ARD 3.1) of multiple computers with the same IP address. It will only save ONE. I've tried 'add by address', adding a list for each computer or adding a list for all those computers. Nothing has worked. ARD will actually change the first computer's IP address to 0.0.0.0
    Example: Static IP address
    Computer 1 xx.xxx.xxx.xxx:51 (public port 51 is forwarded to port 5900 on computer 1)
    Computer 2 xx.xxx.xxx.xxx:52 (public port 52 is forwarded to port 5900 on computer 2)
    Computer 3 xx.xxx.xxx.xxx:53 (public port 53 is forwarded to port 5900 on computer 3)
    Has Apple really overlooked this or am I missing something? Isn't this how most people would remotely manage multiple Macs offsite?
    Thanks

    ARD cannot do this as you're asking. If your
    workstations get their addresses from an NAT device
    rather than being "real", the ports also need to be
    forwarded in the router to the workstation's internal
    IP address. ARD uses port 3283 for the reporting and
    updating function, so if your Macs are getting their
    IP addresses through NAT, since you can only forward
    a port to a single workstation, you can only get
    reports, push package/files to etc. for a single
    workstation.
    ARD uses the VNC protocol for observation and
    control, though, and there are a range of IP
    addresses for that protocol, starting with 5900. ARD
    uses 5900 by default, so that port would be forwarded
    to the first workstation. You would, I believe, need
    to install VNC servers on the systems (since the ARD
    client cannot listen on any port other than 5900
    while VNC servers can be set for other ports such as
    5901, 5902, etc. You would then forward 5901 to the
    second workstation (and on to 5902, 5903, etc.). You
    can then use the following information:
    Remote Desktop 2: How to specify a port number
    for a VNC client
    to connect.
    The only other options are: 1) to run the ARD
    administrator on a workstation on the network, and
    then take control of that system from outside, either
    via VNC or another copy of ARD, or 2) set up a
    virtual private network (VPN) so that when you
    connect from outside, your admin system is officially
    part of the local network.
    Hope this helps.
    That definitely helps. I have ARD installed on my MBP and on a workstation on the LAN. I have used ARD from the MBP to control ARD on a workstation on the local network, but it can get a little tricky. I already have VNC setup on all the workstations. I used to use COTVNC prior to purchasing ARD 3.1.
    I guess what I'm really asking is...
    How do I add a list of workstations and save the settings (same IP address for each workstation with different ports?) to control/VNC via ARD?
    I simply want a list that shows each workstation, so I can control/VNC them using ARD offsite.
    Name: Computer 1 IP Address: 123.123.123.123:5901
    Name: Computer 2 IP Address: 123.123.123.123:5902
    Name: Computer 3 IP Address: 123.123.123.123:5903
    I don't want to have to manually type in the IP address into ARD every time.
    Will ARD simply not add another computer to the list if it has the same IP address but different port number as a computer already on the list? I haven't been able to find a way to make ARD do this.

  • Multiple response streams ?   HTML and binary ?

    Hello,
    Is it possible for a Servlet to create two responses or two output streams, with one as HTML and the other as binary?
    The code below only seems to send the first (HTML) section and seems to ignore the second (binary) section ?
    Thanks alot !!!
    James
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class MinimalBinaryStream extends HttpServlet
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
        doGet(request, response);
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        /*----------Below: Send HTML Response----------*/
        response.setContentType("text/html");
        ServletOutputStream out = response.getOutputStream();
        out.print("<h3>Text message to say binary file is on its way</h3>");
        out.flush();
        out.close();
        /*----------Below: Send Binary Response----------*/
        response.reset();
        response.setContentType("application/octet-stream");
        response.setContentLength(3);
        out = response.getOutputStream();
        out.write(0x31);
        out.write(0x32);
        out.write(0x33);
        out.flush();
        out.close();
    }

    The servlet validates the serial number. If the
    serial number submitted is invalid, then the servlet
    simply sends an HTML message to the client saying
    "Invalid serial number, please try again, etc,
    etc".
    If the serial number is valid, then the server
    encrypts it into a ZIP file and sends the ZIP file to
    the client. (This part is working perfectly by the
    way.)It sounds like you're not really mixing the two types of data in a single response... You're doing one or the other depending upon the value of some data the client has sent to the server
    I wouldn't use the sendRedirect method off of the response. That causes a new get request to be issued from the client which is not necessary. I'd use the RequestDispatcher, preserving the initial request and forwarding both the request and response to another resource on the server. The client is unaware of any of it.
    if ( serial number valid ) {
         // encrypt to ZIP
         // send zip to client on response...
    } else {
         ResquestDispatcher dispatcher = request.getRequestDispatcher( "redirect.html" );
         dispatcher.forward( request, response );
    }http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/RequestDispatcher.html
    What would be really nice, is if the servlet could
    also send an HTML message saying "Thanks for your
    serial number, here is your licence.ZIP, etc,
    etc".For this, maybe you could create a jsp page with a link that pointed to the ZIP file on the server. You would define the name dynamically, and attach the name to the request via setAttribute. Then use that same value in the href value on the jsp page. via request.getAttribute The jsp page would contain the message in html and the client would obtain the zip from the link. And use the RequestDispatcher to forward to the jsp page from the servlet. Place the jsp inside /WEB-INF so that by itself it is not accessble to the client. Only the server code can get to it.

  • Network drives fail (drives used to share databases among multiple computers)​.

    I am using databases on multiple computers to store test results for a production line. The computers share info from thier databases with each other using dsn's made with the ODBC Windows XP Admin Tool (Control Panel). This works well most of the time but occasionally one of the network drives fails - I have to disconnect and then use ODBC to make a new connection (a new dsn). Why are the network drives failing? Should I use somenthing else that is more reliable? datasocket? Shared Variable? [email protected]

    Gary MavSysInc,
    When you say that your program fails, are you referring to the same thing as your LabVIEW Application that is reterieving data? If so, what do you mean by it fails? Is there an error message? Does it Crash? What happens when it "fails"?
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • When Facebook is open in browser; computer will turn off montiro but not sleep, hibernate, etc... multiple computers effected, same problem... just me?

    When one of my family members' leaves their facebook "feed" page open in firefox, the computer will not go to sleep, nor hibernate automatically. This effects multiple different computers running Windows 7 and Vista.
    I believe it has to do with the update-window scripting, though I do not know why the browser(?) is keeping the computer awake. Peculiar though because watching a movie in the browser allows automatic sleep.. Must just be scripting.
    Anyone have this issue or know of a "fix"?

    I have resolved the problem.
    I replaced the AC adapter. Everying works find now. I tested runing the computer without the battery, and it works. So I might add that a possible test for an adapter that is not functioning properly is to try running it w/out the battery. If it does not run its possible that the ac adapter does not work.
    Thanks.

  • Using Aperture Library from Multiple Computers

    My Aperture library is on an external drive and I have used multiple computers to add files to the library. Unfortunately when I use a different computer than the origin it tells me that the masters are unavailable and I cannot use the image. It tells me they are offline . Any fixes?

    If you put the library entirely on the external drive then no, you won't be able to view previews when the hard drive is disconnected.
    To do that, and share edits with your brother, you'll need to import and export projects. It might be possible to use referenced images, and import or export the project without consolidating masters first, if your masters are on the external drive. I think you'll just need to do some testing, and have a read of 'bagelturf's pages about how the library is organised, and how referenced images work.
    http://www.bagelturf.com/aparticles/ref/index.html

  • Can I setup common iPhoto library for multiple computers...

    Hi -
    Is it possible to have one library that is accessible from multiple computers in different locations? For example, my office Mac, my home Powerbook and our vacation home iMAC can all share the same photo library? I am downloading pictures from many different sources and in different locations and would like a centralized library.. I guess this would be the equivalent of cloud computing for iPhoto...
    Thanks,
    M.

    Possibly. I've not used the feature but if you have a MMe account you could setup "Back to my Mac" so that two of your Macs could access the Mac designated to house the library you might be able to do what you want. It would be best to have an external FW hard drive connected to that library to house the library.
    I've used an iPhoto library on my iMac from my laptop on our home WAN. But that was with Screen Sharing. Don't know if the Back to My Mac method would work.
    I've used VNC to connect to my iMac from the laptop but don't know if that will let me add photos to the library there as that method has me virtually on the iMac. You could try it with a test library and one of the VNC applications. I use Chicken of VNC. You must setup Remote Management under Sharing on the host computer and install CVNC on the remote Macs. Create a test library and give it a try. Both with VNC and Back to My Mac if you have it.
    If any of the two satellite Macs would be wirelessly connected that will be a problem due to occasional dropouts. If a wireless Mac was using the library and had a dropout that could damage the library's database and require some rebuilding effort which may or may not be 100% effective. That connection would also be slow.
    If they are hard wired to the internet it would be much more probable that it would work as you'd like and be more reliable.
    An alternative method for "syncing" the libraries (if you have a MMe account) would be to create iPhoto MMe galleries of new photos from each Mac with the option for downloading the full sized image file. Once each Mac has downloaded and imported the new photos the gallery could be deleted.

  • FRUSTRATION - why can't I add music from multiple computers to my iPhone??

    I use multiple Mac computers in my life. My home computer has about 30 gigs of music. My work computer has about half that. Therefore syncing in any case is not an option. I have added some music from home to my new iPhone, and I want to do the same from my work computer but cannot! WHY?? I can do this with my 5th gen Video iPod no problem.
    Plugged into my work computer now, I try to set the iPhone again to "manually manage music," but it still tells me the iPhone is synced with another computer (it is not, since I immediately disabled the sync feature before adding music). Is this going to be the case if I want to add photos from multiple computers, etc., too?
    WHY?? WHY??? WHY?????
    SO FRUSTRATING...

    You're welcome.
    Maybe I'm missing something, but i still struggle to see the connection. Disk mode is the iPods ability to be mounted as a disk on the desktop, allowing the free disk space to be used manually. It exists completely outside the iPods normal, iTunes-driven functions, right? What we are missing on the iPhone is a simple feature from inside iTunes – a feature that all other iPods (as far as i know) have. Strange that the "Amazing iPod" does not.
    Disk mode has everything to do with the ability to transfer iTunes content to an iPod from multiple computers. This is not a simple feature from inside iTunes.
    Do you have an iPod? If so, are you transferring iTunes content from more than one computer to your iPod? If so, do you have disk mode enabled for your iPod? If yes, turn off disk mode and test if you are still able to transfer iTunes content from more than one computer to your iPod.
    Nothing prevents me from admitting when Apple goes wrong or disappoints, but this is not the place for it. This is a user to user help forum for technical support issues and questions only which has a terms of use. Discussing Apple's policies and procedures and ranting is specifically against Apple's terms of use for these discussions.
    Since this is a user to user help forum only, no one here knows Apple's reason or reasons why disk mode is not supported with the iPhone. The only answer you will get here or anywhere else for that matter is someone's opinion, unless Apple makes an announcement or information is provided by an exec during an interview. IMO, there must be a valid reason or reasons why disk mode is not supported with an iPhone since it is supported with iPods. Since disk mode is supported with iPods, more than likely there isn't a technical reason why it isn't supported with an iPhone, so I seriously doubt that Apple decided not to support disk mode with the iPhone just for kicks, or for no valid reason or reasons whatsoever on their part.
    Until I know Apple's reason or reasons, it is difficult for me to admit Apple has gone wrong in this regard, for it may make Apple right for a reason or reasons we don't know, which can be disagreed on. Once facts are known, just because you believe Apple has gone wrong and/or you are disappointed doesn't mean I believe the same, which may or may not have anything to do with being an Apple fan - maybe we just don't agree.
    My brand loyalty goes only so far. I did plenty of research on the iPhone before making the decision to purchase one. Before purchasing an iPhone, I can count on one hand the number of MMS I had exchanged. I have used a number of Palm handhelds for business - before they began selling a Palm cell phone, and I don't recall editing a word or excel document once during all that time. I wasn't interested in doing so with such a small screen, and since I wasn't interested in doing any editing, cut/copy/paste wasn't critical to me either.
    If these features were very important to me - features I used on a daily or very regular basis, I would not have purchased an iPhone regardless the other features it includes. I certainly wouldn't purchase one anyway knowing these things, followed by wasting my time at an Apple user to user help forum for technical support issues and questions whining and ranting about it, which is common here by an immature small percentage of users. There is nothing wrong with providing constructive comments here, which constructive being the key word. There are some folks here who don't know what the word constructive means and don't have a clue about how use it.

  • Service Status - Filter by test-connection status

    I would like the script to skip computers that are not responding to the test-connection status. I have pieced this script together off others on the www. So I do not really know what I am doing. Please assist.
    $strCategory = "computer"
    $objDomain = New-Object System.DirectoryServices.DirectoryEntry
    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher
     $objSearcher.SearchRoot = $objDomain
     $objSearcher.Filter = ("(objectCategory=$strCategory)")
    $colProplist = "name"
     foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}
    $colResults = $objSearcher.FindAll()
    foreach ($objResult in $colResults)
         {$objComputer = $objResult.Properties; $objComputer.name}
    C:\myscipts\getpcnames.ps1 > "C:\myscripts\Computers.txt"
    C:\Users\wgrier\Documents\getpcnames.ps1>"C:\myscripts\Computers.txt"
    Get-ContentC:\myscripts\computers.txt|ForEach-Object{
    $svr=$_;
    Get-Service-NameWSearch-ComputerName$svr}
    |Format-tableName,status,machinename-autosize|out-file-filepathC:\results.txt 
    The Black script works without a issue, my part works but is slow and returns errors on the computers that are not powered on, this is why I am asking for a way to filter the script to only run on the pc's that test-connection .  

    Wayne is your question about Configuration manager 2007? Can you please explain your scenario, it is not clear on what you are trying to achieve from your question. Please clarify so that I can move it to the right forum so that you can get more help.
    Thx.
    Kerim
    This posting is provided "AS IS" with no warranties, and confers no rights.

  • I keep getting the box that asks "Do you use the Yahoo! Toolbar on multiple Computers. It asks Save to my Yahoo! ID, or No thanks, just save to this computer. How do I get rid of this one way or the other?

    When I log on to Firefox, I get this block that pops up saying, "Do you use the Yahoo! Toolbar on multiple computers? It has 2 buttons asking "Save to my Yahoo! ID or No thanks, just save to this computer" It drops down from the Yahoo toolbar, next to the Y! on the left side of the tool bar. I have tried the Save button and no response, I tried the No thanks button no response. I tried the underlined "Learn more" and it too no response. I tried the close X but that does not get rid of this box. I tried right clicking and no response. It stays there through out while working on the mail, I cannot access the that toolbar so I cannot use the buttons on this tool bar. Please help or I will have to try another browser to see if it go away.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    * [[Troubleshooting extensions and themes]]
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)

  • Can I use the Photoshop Creative Cloud on multiple computers?

    I'm interested in buying Photoshop Creative Cloud, but work off of multiple computers.  Will I be able to use the Photoshop on multiple computers via the Creative Cloud?  How does this work?
    Mahalo.

    Or you may purchase Creative Cloud Team subscription and purchase activation seats as per your choice depending upon on how many computers you wish to activate the apps .
    Adobe Creative Cloud – FAQ

  • Multiple Computers on the same network

    We're currently transitioning to Windows 8.1 MRD after many years running OSX and ARD in our small office.
    We have two computers that we need to access independently from the outside. We opened up the recommend port for MRD and have it working as expected on a single computer. However, we can only gain access to a single machine from the outside. With Apple Remote
    Desktop, you simply open up additional ports to allow access for multiple machines. Super easy. We decided to do the same with MRD, but failed with everything we attempted.
    Does MRD not support using custom ports for multiple computers?
    Thanks in advance.

    Hi,
    Thank you for posting in Windows Server Forum.
    We can achieve the result as you want with remote desktop connection. We need to allow the port from firewall end and can apply particular rules with advanced option for specific ports. Also if you are using Routers then need to open the port from router end,
    and finally when connecting user “servername:portnumber” and provide credentials.
    Please checkthis article for more details.
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    TechNet Community Support

  • Syncing to multiple computers

    when syncing my ipod touch to my computer at work, it deletes everything stored from my home computer. what am i doing wrong?

    If you want to connect and use an iPod on more than one computer you need to change the update preference in the iPod Summary tab to "Manually manage music and videos" and click Apply. In this mode you can directly access the content of the iPod and play it through iTunes and you can drag and drop whatever you want to the iPod from either library:
    Using iPod with Multiple computers
    Managing content manually on iPod
    iPod 101: Fill 'er Up

  • Using Messages with Multiple Users and Multiple Computers

    I have two users who share two different computers, switching between them during the day.
    I'd like to use messages on them for us to send text messages in the office, however, it asks them on logging in (most, but not everytime) to re-enter their apple id password.  It seems that using icloud for messages among multiple computers like this isn't good.  its like it wants each computers to be linked with a particular user, and doesn't like it that the users are moving around from computer to computer
    Options to avoid this nuisance?
    1.  Would bonjour messaging work, and then just remove the icloud account from messages?
    2.  How about setting up the message server on my ML Server, would that avoid this problem?

    I'd say probably make sure that in the advanced tab under edit>preferences you should make sure they both point to the same file.
    My turn now, how to i post a thread, there's no button.

  • Pop up box in yahoo mail won't close, asks "do you use the yahoo! toolbar on multiple computers?" has option buttons but no response when clicking on anything, pop up box just sits there in the way

    whenever I open my yahoo mail when using Firefox, a pop up box appears on the upper left side of the screen, it asks the question "do you use the yahoo! toolbar on multiple computers?" and gives click boxes for "Save to my yahoo ID" and "No thanks, just save to this computer". I get no response to clicking on either box, nor will the pop up close if I click on the "X" in the upper right corner of this pop up. It won't close out and it sits right over the top of the email messages in my inbox. All else seems to work fine, but can't get rid of this pop up box....very annoying.

    go mail.yahoo.com as the login entrance for yahoo mail.

Maybe you are looking for

  • Problem with image map

    I am trying to create an image map for the map found on my homepage - http://www.smartcharteribiza.com/ I have followed a couple of tutorials and everything seems to be working in photoshop, but when I upload the image to wordpress, the map does not

  • Send a break to interrupt a query?

    With SQL plus it is possible to interrupt a long running query. This is being discussed in this thread: Killing long running SQL query Is something like this possible in APEX? Rene

  • Help! ipod not synching with PC or MAC

    Hi everyone, I desperatly need help. My ipod isint being recognised by my PC or MAC. I cant add anything to it or anything. The do not disconnect sign comes up on ipod screen but it doesnt seem to synch with the computer. Help will be greatly appreci

  • Webcenter 11g tutorial

    Hi, I would like to follow the webcenter 11g tutorial which stands in the oracle fusion middleware 11g documentation library. For this tutorial you need to have sample tutorial files. In the tutorial there is this link http://www.oracle.com/technolog

  • ASA-SSM-10 with IME: certificate expiration

    ASDM and IDM work fine with my SSM. I'm attempting to add my SSM as a new device into (just installed) IME 7.0.1. Dialog box says: IOException when try to get certificate: java.security.cert.CertificateExpired Exception: NotAfter: Tue Jul 28 04:44:51