+ Post New Thread
Results 1 to 9 of 9
Scripts Thread, Scripts to restart RM Service host (CC4) in Coding and Web Development; As discussed in another thread, run on the FRDC to solve many niggly CC4 problems that come up Server 2003 ...
  1. #1

    Join Date
    Mar 2009
    Location
    Norton, N. Yorks
    Posts
    86
    Thank Post
    36
    Thanked 8 Times in 8 Posts
    Rep Power
    13

    Scripts to restart RM Service host (CC4)

    As discussed in another thread, run on the FRDC to solve many niggly CC4 problems that come up

    Server 2003
    @echo off
    rem ********************************
    rem Unlocks DNS and service host and deletes cache
    rem **********************************

    @echo on

    net stop /yes "DNS Server"
    @ECHO Waiting for DNS Server Service To stop
    :loop2
    @REM Wait for 5 seconds
    @PING 1.1.1.1 -n 1 -w 5000 >NUL
    @ECHO Checking Service State
    @sc query "DNS" | @FIND "1 STOPPED"
    @If %ERRORLEVEL% NEQ 0 goto loop2
    @ECHO Confirmed: DNS Server Service stopped

    net stop /yes "RM Printer Credits Manager Service"
    @ECHO Waiting for RM Printer Credits Manager Service To Stop
    :loop5
    @REM Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @ECHO Checking Service State
    @sc query "RMAudPrnCredits" | @FIND "1 STOPPED"
    @If %ERRORLEVEL% NEQ 0 goto loop5
    @ECHO Confirmed: RM Printer Credits Manager Service Stopped

    net stop /yes "RM service Host"
    @ECHO Waiting for RM service Host To Stop
    :loop6
    @REM Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @ECHO Checking Service State
    @sc query "RM service Host" | @FIND "1 STOPPED"
    @If %ERRORLEVEL% NEQ 0 goto loop6
    @ECHO Confirmed: RM service Host Service Stopped

    @ECHO Clearing service host cache
    @REM Wait for 30 seconds
    del /Q /F "C:\Documents and Settings\All Users\Application Data\RM\Connect\Comms\*.rmcache"
    del /Q /F "C:\Documents and Settings\All Users\Application Data\RM\Connect\Comms\*.cache"
    RD /Q /S "C:\Program Files\RM\Connect\Comms\RemotingHost"
    RD /Q /S "C:\Program Files\RM\Connect\Comms\HostedProxies"

    net start /yes "RM service Host"
    @ECHO Waiting for RM service Host To Start
    :loop7
    @REM Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @ECHO Checking Service State
    @sc query "RM service Host" | @FIND "4 RUNNING"
    @If %ERRORLEVEL% NEQ 0 goto loop7
    @ECHO Confirmed: RM service Host Started

    net start /yes "RM Printer Credits Manager Service"
    @ECHO Waiting for RM Printer Credits Manager Service To Start
    :loop8
    @REM Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @ECHO Checking Service State
    @sc query "RMAudPrnCredits" | @FIND "4 RUNNING"
    @If %ERRORLEVEL% NEQ 0 goto loop8
    @ECHO Confirmed: RM Printer Credits Manager Service Started

    net start /yes "DNS Server"
    @ECHO Waiting for DNS Server Service To start
    :loop4
    @REM Wait for 5 seconds
    @PING 1.1.1.1 -n 1 -w 5000 >NUL
    @ECHO Checking Service State
    @sc query "DNS" | @FIND "4 RUNNING"
    @If %ERRORLEVEL% NEQ 0 goto loop4
    @ECHO Confirmed: DNS Server Service started
    Server 2008 R2:
    @echo off
    rem ********************************
    rem Restarts service host and deletes cache
    rem **********************************

    @echo on

    net stop /yes "RM Printer Credits Manager Service"
    @ECHO Waiting for RM Printer Credits Manager Service To Stop
    :loop5
    @REM Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @ECHO Checking Service State
    @sc query "RMAudPrnCredits" | @FIND "1 STOPPED"
    @If %ERRORLEVEL% NEQ 0 goto loop5
    @ECHO Confirmed: RM Printer Credits Manager Service Stopped

    net stop /yes "RM service Host"
    @ECHO Waiting for RM service Host To Stop
    :loop6
    @REM Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @ECHO Checking Service State
    @sc query "RM service Host" | @FIND "1 STOPPED"
    @If %ERRORLEVEL% NEQ 0 goto loop6
    @ECHO Confirmed: RM service Host Service Stopped

    @ECHO Clearing service host cache
    @REM Wait for 30 seconds
    RD /Q /S "C:\Program Files (x86)\RM\Connect\Comms\HostedProxies"
    RD /Q /S "C:\Program Files (x86)\RM\Connect\Comms\RemotingHost"
    del /Q /F "C:\ProgramData\RM\Connect\Comms\*.rmcache"
    del /Q /F "C:\ProgramData\RM\Connect\Comms\*.cache"
    del /Q /F "C:\Documents and Settings\All Users\Application Data\RM\Networks\RMMC\CacheManager\*.rmcache"

    net start /yes "RM service Host"
    @ECHO Waiting for RM service Host To Start
    :loop7
    @REM Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @ECHO Checking Service State
    @sc query "RM service Host" | @FIND "4 RUNNING"
    @If %ERRORLEVEL% NEQ 0 goto loop7
    @ECHO Confirmed: RM service Host Started

    net start /yes "RM Printer Credits Manager Service"
    @ECHO Waiting for RM Printer Credits Manager Service To Start
    :loop8
    @REM Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @ECHO Checking Service State
    @sc query "RMAudPrnCredits" | @FIND "4 RUNNING"
    @If %ERRORLEVEL% NEQ 0 goto loop8
    @ECHO Confirmed: RM Printer Credits Manager Service Started
    Last edited by d-taylor; 17th January 2013 at 04:18 PM.

  2. #2

    Join Date
    Nov 2012
    Location
    Surrey
    Posts
    68
    Thank Post
    4
    Thanked 10 Times in 10 Posts
    Rep Power
    6
    Using the Server 2003 version it appears to get stuck going around in loop2.

    Am I missing something?

  3. #3

    Join Date
    Mar 2009
    Location
    Norton, N. Yorks
    Posts
    86
    Thank Post
    36
    Thanked 8 Times in 8 Posts
    Rep Power
    13
    I've not needed to use the Server 2003 ones fo ra while. If you are fully up to date with RM updates, you can take the DNS stop and start out, and see if it runs

  4. #4

    Join Date
    Oct 2011
    Location
    Cheadle, Staffordshire
    Posts
    11
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    If just the RM Service Host start/stop bits of the script were used, would that be o.k to use on the student machines?

  5. #5

    Join Date
    Mar 2009
    Location
    Norton, N. Yorks
    Posts
    86
    Thank Post
    36
    Thanked 8 Times in 8 Posts
    Rep Power
    13
    You just need to restart the RM Service Host service on student machines, no need to delete any files. If you need to restart RM Service Host on a large number of workstations regularly, I'd recommend logging a call with RM

  6. #6

    Join Date
    Oct 2011
    Location
    Cheadle, Staffordshire
    Posts
    11
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    It's for article TEC1395295 on the RM website. "Root Element is Missing"
    The service host has to be restarted after a certain file is deleted and another renamed.

    Just want to know if the following would work on the student machines.

    net stop /yes "RM service Host"
    @echo Waiting for RM service Host To Stop
    :loop6
    @Rem Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @echo Checking Service State
    @sc query "RM service Host" | @FIND "1 STOPPED"
    @If %ERRORLEVEL% NEQ 0 goto loop6
    @echo Confirmed: RM service Host Service Stopped

    net start /yes "RM service Host"
    @echo Waiting for RM service Host To Start
    :loop7
    @Rem Wait for 30 seconds
    @PING 1.1.1.1 -n 1 -w 30000 >NUL
    @echo Checking Service State
    @sc query "RM service Host" | @FIND "4 RUNNING"
    @If %ERRORLEVEL% NEQ 0 goto loop7
    @echo Confirmed: RM service Host Started

  7. #7
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    604
    Thank Post
    68
    Thanked 17 Times in 16 Posts
    Rep Power
    20
    The RM Service Host service doesn't need to be restarted after renaming the file in the data access folder. Just rename a valid one and simply assign the package again!

  8. #8
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    604
    Thank Post
    68
    Thanked 17 Times in 16 Posts
    Rep Power
    20
    If you do want to restart the RM SH service on remote machines the following script will prompt you for a machine name and do this for you. You will need to download psservice (PsService) and place it in the %windir% of your own computer to be able to remotely manage services but makes the task much easier and convenient should you need to do this from time to time.

    Code:
    ::Remote RM Service Host service restart script
    ::Created by JShand: 12:30 03/08/2012 @echo OFF
    Set /P Computer=Restart RM Service Host service on computer:
    ECHO ****STOPPING THE "RM DESKTOP AGENT" SERVICE****
    psservice \\%Computer% stop DAService 2>nul
    ECHO ****RESTARTING THE "RM SERVICE HOST" SERVICE****
    psservice \\%Computer% restart "RM Service Host" 2>nul
    ECHO ****STARTING THE "RM DESKTOP AGENT" SERVICE****
    psservice \\%Computer% start DAService 2>nul @echo ****CHECKING SERVICE STATES****
    :check1 @psservice \\%computer% query "DAService" | @FIND "4  RUNNING" 2>nul
    @If %ERRORLEVEL% NEQ 0 goto :DAstopped
    @If %ERRORLEVEL% EQU 0 goto :DAstarted
    :DAstopped @echo RM Desktop Agent service is NOT running on %Computer%
    goto :check2
    :DAstarted @echo RM Desktop Agent service RESTARTED on %Computer%
    :check2 @psservice \\%computer% query "RM Service Host" | @FIND "4  RUNNING" 2>nul
    @If %ERRORLEVEL% NEQ 0 goto :SHstopped
    @If %ERRORLEVEL% EQU 0 goto :SHstarted
    :SHstopped @echo RM Service Host service is NOT running on %Computer%
    goto :end
    :SHstarted @echo RM Service Host service RESTARTED on %Computer%
    :end
    @PAUSE

  9. Thanks to randle from:

    railfrog (20th February 2013)

  10. #9

    Join Date
    Oct 2011
    Location
    Cheadle, Staffordshire
    Posts
    11
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks for that.

    Will give it a go tomorrow.



SHARE:
+ Post New Thread

Similar Threads

  1. script to only run if it cant ping a host
    By RabbieBurns in forum Scripts
    Replies: 9
    Last Post: 18th September 2014, 12:54 AM
  2. script to shutdown guest & host ESXi
    By Vanit in forum Thin Client and Virtual Machines
    Replies: 15
    Last Post: 3rd May 2011, 09:00 PM
  3. Script to restart conky
    By llawwehttam in forum Scripts
    Replies: 9
    Last Post: 4th January 2010, 09:18 PM
  4. Script to Restart Service
    By enjay in forum Windows Server 2000/2003
    Replies: 7
    Last Post: 23rd September 2009, 08:27 PM
  5. VBS code to restart a service.
    By FN-GM in forum Scripts
    Replies: 4
    Last Post: 8th October 2008, 10:18 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •