SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Simple question... how do I get the machine name off of the SPContext object.

share|improve this question
What are you trying to do? – Mike Oryszak Dec 3 '11 at 2:43
up vote 5 down vote accepted

Maybe SPServer.Local is what you are looking for...

share|improve this answer
indeed it was, thanks! – dbobrowski Dec 5 '11 at 14:04

I'm not sure why you would use SPContext for that - perhaps you are looking for this instead: Environment.MachineName

share|improve this answer

Try HttpContext.Current.Server.MachineName

share|improve this answer

POSH Scripts to get you server info

(Get-SPServer has other params - check for unique server)

$myserver = Get-SPServer $myserver | select-object *

share|improve this answer
there should be line after Get-SPServer (this editor didn't pick it up) – Supriyo SB Chatterjee Dec 2 '11 at 17:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.