vbscript fails for non-admin user in sharepoint

we have created a shortcut in sharepoint to allow the currently logged in user to get the local machine name of their computer.  here is the script:

Set objPC = CreateObject( "WScript.Network")
strComputerName = objPC.ComputerName
msgbox "Computer Name: " & strComputerName, vbokonly + vbinformation, "Computer Name"

the problem is, it fails on line 1 unless the user is an admin.  how can I run this script for domain users without admin rights?

BTW, this script works fine on XP but not on Windows 7.
dhenderson12Asked:
Who is Participating?
 
Jamie McAllister MVPSharePoint ConsultantCommented:
I don't have documentation stating that, but I've certainly heard of people having this issue when moving to Win7.
0
 
Jamie McAllister MVPSharePoint ConsultantCommented:
Possibilities are the new machines are x64 and a refactor of the script to run in an x32 compatible mode is needed; (though doesn't explain why admins can do it)

http://stackoverflow.com/questions/2806584/how-do-i-run-a-vbscript-in-32-bit-mode-on-a-64-bit-machine

WSH needs updating; http://www.visualbasicscript.com/m48646-print.aspx

SCRRUN DLL;

http://www.visualbasicscript.com/m31697.aspx

Or Group Policy may need changing to allow this...
0
 
dhenderson12Author Commented:
I tend to think you're correct about the group policy ... however it works ok on XP.  Are the policy settings more "paranoid" in windows 7 that they need to explicitly set?
0
 
pcsmitpraCommented:
Set objPC = CreateObject( "WScript.Network")
strComputerName = objPC.ComputerName
msgbox "Computer Name: " & strComputerName, vbokonly + vbinformation, "Computer Name"

Try This
Set objPC = Wscript.CreateObject( "WScript.Network")
strComputerName = objPC.ComputerName
msgbox "Computer Name: " & strComputerName, vbokonly + vbinformation, "Computer Name"
0
 
dhenderson12Author Commented:
None of the vbscript options have worked.  Our IT team replaced it with a powershell script that does work.  Thanks to all for you help.  I'm splitting the points to all who participated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.