Showing posts with label desktop. Show all posts
Showing posts with label desktop. Show all posts

Friday, March 6, 2015

SCCM Task Sequence User Verification

We know that Config Manager's Task Sequences run with a system account and can only be advertised to Device collections.

What if we wanted only certain people to have permission to re-image their computer?

This script will record the logged in username via wmi as a Task Variable.
If that account is a member of a specific domain group then the 'ValidUser' Task Variable will be set as True.

You can then use that 'ValidUser' Task Variable to allow groups or other commands/applications to run.



To test the sequence with the msgbox dialogs you will need the ServiceUI.exe file from the Microsoft Development kit.

'Find Logged in user
'Version 1.60
on error resume next
Dim objNetwork, objDomain, oTaskSequence
'msgbox "Testing"
'Create Objects
Set objNetwork = CreateObject("Wscript.Network")
Set objDomain = GetObject("LDAP://RootDSE")
Set oTaskSequence = CreateObject ("Microsoft.SMS.TSEnvironment")

' Obtain user information.
'strUserName = objNetwork.UserName
strcomputer = "."

Set objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
Set colSessions = objWMI.ExecQuery ("Select * from Win32_ComputerSystem",,48) 
For Each objItem in colSessions 
if objItem.Username <> "" then
strUserName = Replace(Lcase(objItem.UserName),"prairiesouth","")
oTaskSequence("UserName") = replace(strUserName,chr(92),"")
'msgbox strUserName
else
strUserName = objNetwork.UserName
end if
next

If not lcase(strUserName) = "system" then
'Verifies not the System account.
strDomain = objDomain.Get("dnsHostName")
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUserName)
For Each strGroup in objUser.Groups
If Lcase(strGroup.Name) = "help desk end users" or Lcase(strGroup.Name) = "information technology department" then
strValid = 1
oTaskSequence("UserGroup") = strGroup.Name
'msgbox strGroup.Name
exit for
end if
Next
else
strValid = 0
end if

If strValid = 1 then
oTaskSequence("ValidUser") = "True"
'msgbox strValid
Else
oTaskSequence("ValidUser") = "False"
'msgbox strValid
end if


More SCCM related posts

Monday, April 28, 2014

Rainmeter Custom Desktop Skin

Keep update on this project by following this link... http://bit.ly/netadmlr


April 30, 2014
Changed from Images to Buttons (Changes Icon based on mouse action - hover/click)
 - Includes Paint.Net PDN files for you to change
Battery Skin
 - Changed "Charging" to "AC Power"

Future versions will include the option to disable Right mouse button by adding
RightMouseUpAction=[] at the top of each skin in the [Rainmeter] section.

April 29, 2014

Shutdown/Restart/Log Off Bug - You will have to change the Logoff.cmd and Restart.cmd commands to say shutdown.exe other wise it will run the shutdown.cmd file before the shutdown.exe file. 

April 28, 2014
Uploaded the Rainmeter skin for the Custom Lync Room system to DeviantArt

Requires Rainmeter 3.1 - http://rainmeter.net/

Latest version of the Lync Room System Rainmeter Skin
http://gmpentaxfan.deviantart.com/art/Lync-Room-System-Custom-Desktop-Rainmeter-Skin-450762970

This allows for desktop icons, date, time, battery level, speaker levels and custom application launching without "explorer.exe" running.

Added the Rainmeter.exe with custom rainmeter.ini to load this skin via the computer startup script.

See previous article... http://gmnetadmin.blogspot.ca/2014/04/custom-lync-room-system.html