Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

4 Answers 4

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
add comment

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

share|improve this answer
add comment

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
add comment

Try HttpContext.Current.Server.MachineName

share|improve this answer
add comment

Your Answer

 
discard

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.