4

I have a HighlyAvailable AppFabric cache setup across 3 servers (AppFabric 1.1). I want to monitor the local cache on each server and, if it is down for any reason start it back up.

Problem

The problem is permissions - I wrote a Powershell script to do this, and it works great if I run while logged in or set up a Scheduled Task to run it as me - but I am an administrator on all machines. If I try running this script with a service user, it fails. I don't want to make my service user an administrator on all 3 machines.

Questions

  • Is there a way to get this working without running it as an administrator? Has anybody else done this?
  • Is there another way to monitor these caches and restart them if they die? I am happy to throw away my powershell script (ok not happy, but I will :).

Additional Detail

I know I can log onto the server and run 'Caching Administration Windows PowerShell' as Administrator, then issue the following commands to check the status of the local node:

Get-CacheHost localhost 22233

Then, if it is down issue the following command to start it:

Start-CacheHost localhost 22233

So, I wrote a powershell script to do this. It works great, other than the permissions issues mentioned above. I haven't shown the script because it isn't really pertinent to this convo, but I will share if it helps.

Community
  • 1
  • 1
MattW
  • 12,902
  • 5
  • 38
  • 65

2 Answers2

2

As per the note mentioned in http://msdn.microsoft.com/en-us/library/hh351453(v=azure.10).aspx I believe it is not possible to start a cacheHost unless you are an Administrator on the machine.

Puneet Gupta
  • 2,237
  • 13
  • 17
  • Yeah, I saw that one. I was hoping somebody had come up w/ a workaround, or I was missing something else. It's not looking good! – MattW Nov 15 '13 at 15:47
1

Directly without admin, not really possible is there some reason that you could not run your powershell monitoring script as a scheduled windows task?

Mike Beeler
  • 4,081
  • 2
  • 29
  • 44
  • I am just trying to avoid running scheduled tasks as Admin on production boxes. I'd like to be a bit more specific about my permissions [i.e. I don't want this script to be able to do anything it wants on the machine - just as a general rule]. – MattW Nov 27 '13 at 12:16
  • The only other option would be to build a console app that invokes powershell http://stackoverflow.com/questions/17067971/invoking-powershell-cmdlets-from-c-sharp – Mike Beeler Nov 27 '13 at 15:31
  • Yeah, but I think that console tool would need to be run as an admin on the machine. I agree that this would work, but not necessarily how I'd like to do it. That being said - I don't think there is a way around running this script (or console tool) as a local admin. – MattW Nov 27 '13 at 18:05
  • The only other way to do it is hunt down all of the service account references and change them including the ones in the registry and probably at least one more place that only microsoft knows about and keep your fingers crossed. Even with that there is a high probability that something will go wrong and fry the installation anyway, unless there are a lot of people that could change your script I would just let it run as admin. – Mike Beeler Nov 27 '13 at 19:10
  • Similar to @MikeBeeler comment, here's a practical implementation of what you are looking for: http://mdcadmintool.codeplex.com/documentation – dawebber Nov 28 '13 at 16:24
  • Noticed that none of the answers were accepted, did you come up with an alternative solution? – Mike Beeler Dec 02 '13 at 00:14
  • @MikeBeeler no, none of the answers solved the problem. The problem I was looking to solve (restarting AppFabric hosts without using an Admin user) isn't really possible. I feel like marking one with an answer isn't valid. Thoughts? – MattW Mar 03 '14 at 15:17
  • Nevermind - just re-read your answer which says it isn't possible :) – MattW Mar 03 '14 at 15:18