Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


vbscript fails for non-admin user in sharepoint

Posted on 2014-01-07
Medium Priority
Last Modified: 2014-01-14
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.
Question by:dhenderson12
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 32

Expert Comment

by:Jamie McAllister MVP
ID: 39763146
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)


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



Or Group Policy may need changing to allow this...

Author Comment

ID: 39763463
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?
LVL 32

Accepted Solution

Jamie McAllister MVP earned 1000 total points
ID: 39764532
I don't have documentation stating that, but I've certainly heard of people having this issue when moving to Win7.
LVL 15

Assisted Solution

pcsmitpra earned 1000 total points
ID: 39765122
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"

Author Comment

ID: 39779329
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.

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question