Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

script only works when running as system account or domain admin

$
0
0
Guys I am having problems with the below script the goal of the script is to install the System Center 2012 client on all of our workstations. The script is being deployed in a gpo if I run this script via the computer catainer it works fine however if I run the script in the context of the users container logged in as a regular user that does have local admin rights to the computer crazy stuff starts occurring. For example, if a client opens our ERP application the configuration manager software blows up and with ccmsetup.exe-application error box popping up on the users screen. Now this is where it gets even stranger if I run this logged in as a domain admin everything works fine. Also if I run the script under the context of the system account it works I've tested this by scoping the gpo to come off of the computer container portion.If I could run this against the computer scope I would the problem is the way our AD was layed out I have over 3000 computer objests in one OU all of these systems are serving users in a wan environment so if I push the client out it will bog down the wan links. However, the users are dropped into there own dedicated ou's so I can push the client out to local file servers than configure a gpo for it to pull from those file server thus nothing pulls across the wan. The System Center installer creates a ccm folder in the C:\WINDOWS directory ccmsetup is actually a file in one of those folders it's like the script keeps trying to call ccmsetup even though it should not be calling anything if it detects HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\SMS\MOBILE CLIENT it should quit. So is there a way to make a script run under the system account even though it's being called from the user section of the gpo. I am a scriptting newbie so any help is much appreicated?





Option Explicit

Dim keyName

Dim objShell

keyName = "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\SMS\MOBILE CLIENT"

If KeyFound(keyName) = True Then

WScript.Quit

Else Set objShell = CreateObject("wScript.shell")
wScript.Sleep 4000
objShell.run "\\configmgr\client\CCMSetup.exe /mp:configmgr /logon SMSSITECODE=ONS FSP=configmgr"

End If
function KeyFound(byval keyName)

keyFound = false

Dim rightCharacter

rightCharacter = right(keyName, 1)

if rightCharacter <> "\" Then keyName = keyName & "\"

on error resume next

createobject("wscript.shell").regRead trim(keyName)

select case err

case 0: keyFound = true

end select

end function



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>