Jump to content


mcbroome

Sccm standalone key self expiration, following the guide exactly! What am I doing wrong?

Recommended Posts

Ok, following the instructions exactly on the guide located here:

 

http://blogs.technet...lone-media.aspx

 

my tsconfig.ini reads as:

[CustomHook]

CommandLine=”cscript.exe X:\ExpiredUFDCheck.vbs”

 

 

the .vbs at the root of my boot image is as follows:

 

' // ***************************************************************************

' //

' // File: ExpiredUFDCheck.vbs

' //

' // Version: 1.0

' //

' // Purpose: Check to see if stand-alone media is expired

' //

' // Usage: cscript ExpiredUFDCheck.vbs

' //

' // ***************************************************************************

 

On Error Resume Next

' // ---------------------------------------------------------------------

' // Find the environment variable %configpath% for location of UFD

' // ---------------------------------------------------------------------

'Set objShell = CreateObject("WScript.Shell")

'Set objExecObject = objShell.Exec("%comspec% /c echo %configpath%")

'configPath1 = objExecObject.StdOut.ReadAll()

'configPath = Mid(configPath1, 1, Len(configPath1) -2)

 

' // -----------------------------------------------------------------------------------------

' // Find the environment variable %TEMP% for location of tool files (e.g. shutdown.exe)

' // -----------------------------------------------------------------------------------------

Set objShell = CreateObject("WScript.Shell")

Set objExecObject = objShell.Exec("%comspec% /c echo %temp%")

temp = objExecObject.StdOut.ReadAll()

tempdir = Mid(temp, 1, Len(temp) -2)

 

' // ---------------------------

' // Find driver letter for UFD

'// ----------------------------

Set FSO = CreateObject("Scripting.FileSystemObject")

Set Drives = FSO.Drives

For Each DiskDrive In Drives

If DiskDrive.DriveType = "1" Then

USBPath = DiskDrive.Path

End If

 

Next

' // -----------------------------------------------------------------

' // Query WMI for creation date of the Policy.xml file on the UFD

' // -----------------------------------------------------------------

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

 

' // ----------------------------

' // Media Check - Policy.xml

' // ----------------------------

Set colFiles = objWMIService.ExecQuery("Select * From CIM_DataFile Where Name = '" & USBPath & "\\SMS\\Data\\Policy.xml'")

 

' // -----------------------------------------

' // Set the date 3 months ago from today

' // -----------------------------------------

dt3MonthsAgo = DateAdd("m", -3, Now)

 

' // -----------------------------------------------------------------------------------------------------------

' // If the Policy.xml file creation date is less than the date 3 months ago from today, it is an expired UFD.

' // -----------------------------------------------------------------------------------------------------------

For Each objFile in colFiles

dtCreationDate = WMIDateStringToDate(objFile.CreationDate)

dtEndDate = DateAdd("m", 3, dtCreationDate)

If dtCreationDate < dt3MonthsAgo then

Set WshShell = CreateObject("WScript.Shell")

Command = TEMPDIR & "\scripts\Shutdown.exe /s /t 0"

MsgBox "This task sequence expired on " & dtEndDate, vbMsgBoxSetForeground, "Expired Task Sequence"

Set oExec = WshShell.Exec(Command)

Else

WScript.Quit(1)

 

End If

Next

 

' // -----------------------------------------------------------------------------------------

' // Converting the WMI date query response to a simple date format. (e.g. 09/21/2010)

' // -----------------------------------------------------------------------------------------

Function WMIDateStringToDate(dtmInstallDate)

WMIDateStringToDate = CDate(Mid(dtmInstallDate, 5, 2) & "/" & Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) & " " & Mid(dtmInstallDate, 9, 2) & ":" & Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, 13, 2))

End Function

 

I set the bios to have the following date: 7/18/13

when I boot from the standalone usb key, I get this:

580885_10150942475637563_273418832_n.jpg

 

 

on pressing "ok" the machine is SUPPOSED to shut down. Instead the expiration notice disappears and I can hit "next to execute the task sequence. The workstation is not shutting down when "ok" is pressed. When I change the Bios to make the Task Sequence valid, it throws an 8005 error becasue of "WScript.Quit(1)" at the end of the script. Thank you for the help in advance!!!!

Share this post


Link to post
Share on other sites

Hi,

Are the Shutdown.exe file present in the %tempdir%\Scripts folder when in WinPE? That is where I would start.. It sounds like you probably need to change wscript.quit(1) to wscript.quit and don't return an exit code as well to get it to work..

 

Regards,

Jörgen

  • Like 1

Share this post


Link to post
Share on other sites

ok, I removed the exit code and changed "Command = TEMPDIR & "\scripts\Shutdown.exe /s /t 0" " to :

Command = "\windows\temp\Shutdown.exe /s /t 0" after copying and pasting shutdown.exe into that path of my mounted boot.wim. I'll commit, recompile and give it a whirl.....wish me luck!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.