Quantcast
Channel: Configuration Manager 2012 - Application Management forum
Viewing all articles
Browse latest Browse all 4762

SCCM VBS permissions detection script

$
0
0

I'm having to create a quick script that will set the modify permission of a folder on the root of C drive. I want to deploy via the application method, and for the detection, I'm setting the script to only run if the permissions have not already been set on the folder in question.

I created a quick VBScript that when tested works well when I run it through manually, but when deploying the application (and I tested via the Application Catalog), it appears to fail during the detection method.  I'm open to ideas.  Here's what I have in place. 

dim strText

strComputer = "."

Set fso = CreateObject ("Scripting.FileSystemObject")
Set stdout = fso.GetStandardStream (1)

Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = ObjShell.Exec("icacls ""C:\Teleresults""")
Do While Not objExecObject.StdOut.AtEndOfStream
    strText = objExecObject.StdOut.ReadLine()

    If Instr(1, strText, "BUILTIN\Users:(OI)(CI)(M)", VBTextCompare) > 0 Then
 stdout.WriteLine "Compliant"
 Else
 Wscript.Quit
End if
Loop


Viewing all articles
Browse latest Browse all 4762

Trending Articles



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