-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLTISuspend.wsf
executable file
·140 lines (89 loc) · 4.54 KB
/
LTISuspend.wsf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<job id="LTISuspend">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript" src="ZTIDataAccess.vbs"/>
<script language="VBScript">
' // ***************************************************************************
' //
' // Copyright (c) Microsoft Corporation. All rights reserved.
' //
' // Microsoft Deployment Toolkit Solution Accelerator
' //
' // File: LTISuspend.wsf
' //
' // Version: 6.3.8330.1000
' //
' // Purpose: Suspend a task sequence to allow manually steps to be performed.
' // Note that this is only supported while in the full OS.
' //
' // Usage: cscript.exe [//nologo] LTISuspend.wsf [/debug:true]
' //
' // ***************************************************************************
Option Explicit
RunNewInstance
'//----------------------------------------------------------------------------
'// Main Class
'//----------------------------------------------------------------------------
Class LTISuspend
'//----------------------------------------------------------------------------
'// Constructor to initialize needed global objects
'//----------------------------------------------------------------------------
Private Sub Class_Initialize
End Sub
'//----------------------------------------------------------------------------
'// Main routine
'//----------------------------------------------------------------------------
Function Main
Dim sDest
Dim sCmd
Dim oLink
If oUtility.Arguments.Exists("resume") then
' Clear the LTISuspend variable
oEnvironment.Item("LTISuspend") = ""
' Clean up the shortcut to me on the desktop
oFSO.DeleteFile oShell.SpecialFolders("AllUsersDesktop") & "\Resume Task Sequence.lnk"
' Run LiteTouch.wsf with /start switch to recreate the shortcut.
' On Server Core, this will actually run LiteTouch.wsf normally.
If (not oFSO.FileExists(oEnv("SystemRoot") & "\Explorer.exe")) or UCase(oEnvironment.Item("HideShell")) = "YES" then
' On Server Core or hiding the shell, so just run LiteTouch.wsf and quit. It will do the rest.
sCmd = "wscript.exe " & oUtility.LocalRootPath & "\Scripts\LiteTouch.wsf /start"
oShell.Run sCmd, 0, False
Else
' Not on Server Core, so run LiteTouch.wsf once (synchronously) to create the
' startup group item and then again (async) to actually run the script.
sCmd = "wscript.exe " & oUtility.LocalRootPath & "\Scripts\LiteTouch.wsf /start"
oShell.Run sCmd, 0, True
sCmd = "wscript.exe " & oUtility.LocalRootPath & "\Scripts\LiteTouch.wsf"
oShell.Run sCmd, 0, False
End if
Else
' Set variables to indicate that we want to "reboot". Also set a flag
' so that LiteTouch.wsf doesn't actually do the reboot.
oEnvironment.Item("SMSTSRebootRequested") = "true"
oEnvironment.Item("LTISuspend") = "true"
' Remove the LiteTouch.wsf shortcut from the startup menu
If oFSO.FileExists(oShell.SpecialFolders("AllUsersStartup") & "\LiteTouch.lnk") then
oLogging.CreateEntry "Removing " & oShell.SpecialFolders("AllUsersStartup") & "\LiteTouch.lnk", LogTypeInfo
oFSO.DeleteFile oShell.SpecialFolders("AllUsersStartup") & "\LiteTouch.lnk"
End if
' Make sure the scripts are local
If not oFSO.FileExists(oUtility.LocalRootPath & "\Scripts\LiteTouch.wsf") then
' Run LTICopyScripts.wsf to copy the needed scripts locally
oShell.Run "wscript.exe """ & oUtility.ScriptDir & "\LTICopyScripts.wsf""", 0, true
End if
' Copy me locally
If not oFSO.FileExists(oUtility.LocalRootPath & "\Scripts\" & WScript.ScriptName) then
oLogging.CreateEntry "Copying " & WScript.ScriptFullName & " to " & oUtility.LocalRootPath & "\Scripts\" & WScript.ScriptName, LogTypeInfo
oFSO.CopyFile WScript.ScriptFullName, oUtility.LocalRootPath & "\Scripts\" & WScript.ScriptName, True
End if
' Make a desktop shortcut to run me.
oLogging.CreateEntry "Creating startup folder item to run LiteTouch.wsf once the shell is loaded.", LogTypeInfo
Set oLink = oShell.CreateShortcut(oShell.SpecialFolders("AllUsersDesktop") & "\Resume Task Sequence.lnk")
oLink.TargetPath = "wscript.exe"
oLink.Arguments = """" & oUtility.LocalRootPath & "\Scripts\" & WScript.ScriptName & """ /resume"
oLink.Save
oLogging.CreateEntry "Shortcut """ & oShell.SpecialFolders("AllUsersDesktop") & "\Resume Task Sequence.lnk"" created.", LogTypeInfo
End if
End Function
End class
</script>
</job>