Skip to main content

os: opening up windows server 2003 service pack 1 for practical functionality...

... or functional practicality or whatever. it's interesting that "secure" has made some things especially troublesome! for instance, out of the box, after applying service pack 1, querying wmi will fail. how do you fix it? you add the account you're using to the local administrators group. now that doesn't sound right since the idea is that we're securing things down. the challenge was to take a user account without elevated permissions and grant it the rights it needs to query wmi without the exposure of adding it to local administrators. it turns out there are three things you have to do to make this work:
  • add the user to "distributed com users" local group
  • grant permission to the wmi namespace for which you wish you allow access (in our case, cimv2)
  • grant permission to service control manager
add the user to "distributed com users" local group:
not much to explain for this. simply add the account to the local group named "distributed com users". i reference an article below. by following this step instead of what's in the article, you can skip anything past #10.
grant permission to the wmi namespace:
when you grant permission, you'll need to grant the following rights:
  • execute methods
  • enable account
  • remote enable
  • read security
you'll also need to grant this permission for "this namespace and all subnamespaces"
grant permission to service control manager:
this step is only necessary if you plan to allow your limited-rights user to query the win32_service class. using sc, you can view the current permissions on scmanager, like this:
  • sc sdshow scmanager
of course that's the easy part. you'll get a big, long sddl in response. assuming your result looks like mine, this is how you want to edit it. by the way, it's all one line in real-life: D:(A;;CC;;;AU)(A;;CCLCRPRC;;;IU)(A;;CCLCRPRC;;;SU)(A;;CCLCRPWPRC;;;SY) (A;;KA;;;BA)(A;;KAFALC;;;[your sid here])S:(AU;FA;KA;;;WD)(AU;OIIOFA;GA;;;WD) remember, that line above is ONE LINE. remove the brackets (duh). put in the sid of the account that you want to grant access. you can use a tool like psgetsid to grab the sid value (or just open adsiedit). once you've got it composed, use this command to apply it:
  • sc sdset scmanager [that long sddl above]
now if you want a really cheesy, automated method that you can deploy to your servers, here's a way to do it. btw, you'll need sc.exe (version specific mentioned in the microsoft article below):

sComputer = "."
Set oServices = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
Set oCIMV2 = oServices.Get("__SystemSecurity=@")
Set oShell = WScript.CreateObject("WScript.Shell")

SetWMIPerms
SetSvcsPerms
SetDCOMPerms

Function SetWMIPerms
    sBinSDDL = Array([add binary sddl here])
    oCIMV2.SetSD(sBinSDDL)
End Function

Function SetSvcsPerms
    sCommand = "sc sdset scmanager [add that same long sddl]"
    oShell.Run sCommand,0
End Function

Function SetDCOMPerms
    sCommand = "net localgroup " & Chr(34) & "Distributed COM Users" & Chr(34) &_
               " " & Chr(34) & "Domain\User" & Chr(34) & " /ADD"
    oShell.Run sCommand,0
End Function
maybe you're wondering how you get that binary sddl that's mentioned in the first function. if you modify a computer to have the correct permissions as noted in the second bullet, you can run this script against the machine. it'll echo back the binary sddl (looks like a long string of numbers and commas) that will contain the changes you've made. here's the cheesy code:
targetmachine = "."

Set objServices = GetObject("winmgmts:\\" & targetmachine & "\root\cimv2")
Set CimV2 = objServices.Get("__SystemSecurity=@")
ReturnValue = Cimv2.GetSD(arrSD)

If Err <> 0 Then
    WScript.Echo "Method returned error " & ReturnValue
End If

SDString = ""

For I = Lbound(arrSD) To Ubound(arrSD)
    SDString = SDString & arrSD(I) & ","
Next

SDstring = Left(SDstring,Len(SDstring)-1)
WScript.Echo SDString
once you have the binary sddl, drop it into the first function. don't forget to remove the [ ] brackets. good luck. :) credit: this article was a lot of help microsoft's article on applying sddl change on service control manager

Popular posts from this blog

using preloadpkgonsite.exe to stage compressed copies to child site distribution points

UPDATE: john marcum sent me a kind email to let me know about a problem he ran into with preloadpkgonsite.exe in the new SCCM Toolkit V2 where under certain conditions, packages will not uncompress.  if you are using the v2 toolkit, PLEASE read this blog post before proceeding.   here’s a scenario that came up on the mssms@lists.myitforum.com mailing list. when confronted with a situation of large packages and wan links, it’s generally best to get the data to the other location without going over the wire. in this case, 75gb. :/ the “how” you get the files there is really not the most important thing to worry about. once they’re there and moved to the appropriate location, preloadpkgonsite.exe is required to install the compressed source files. once done, a status message goes back to the parent server which should stop the upstream server from copying the package source files over the wan to the child site. anyway, if it’s a relatively small amount of packages, you can

How to Identify Applications Using Your Domain Controller

Problem Everyone has been through it. We've all had to retire or replace a domain controller at some point in our checkered collective experiences. While AD provides very intelligent high availability, some applications are just plain dumb. They do not observe site awareness or participate in locating a domain controller. All they want is the name or IP of one domain controller which gets hardcoded in a configuration file somewhere, deeply embedded in some file folder or setting that you are never going to find. How do you look at a DC and decide which applications might be doing it? Packet trace? Logs? Shut it down and wait for screaming? It seems very tedious and nearly impossible. Potential Solution Obviously I wouldn't even bother posting this if I hadn't run across something interesting. :) I ran across something in draftcalled Domain Controller Isolation. Since it's in draft, I don't know that it's published yet. HOWEVER, the concept is based off

sccm: content hash fails to match

back in 2008, I wrote up a little thing about how distribution manager fails to send a package to a distribution point . even though a lot of what I wrote that for was the failure of packages to get delivered to child sites, the result was pretty much the same. when the client tries to run the advertisement with an old package, the result was a failure because of content mismatch. I went through an ordeal recently capturing these exact kinds of failures and corrected quite a number of problems with these packages. the resulting blog post is my effort to capture how these problems were resolved. if nothing else, it's a basic checklist of things you can use.   DETECTION status messages take a look at your status messages. this has to be the easiest way to determine where these problems exist. unfortunately, it requires that a client is already experiencing problems. there are client logs you can examine as well such as cas, but I wasn't even sure I was going to have enough m