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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
| <Html>
<Head>
<Title>:-></Title>
<Style>
Body { Color:gray ; font:12 pt arial ; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#000000', EndColorStr='#0000FF') }
A:link { color: blue }
A:visited { color:blue }
A:active { color:blue }
TR { Color: black; text-align: center ; border: inset 1px solid white }
TH { Background-color: CornflowerBlue ; text-align: center ; font-weight: normal ; border-style: Ridge ; white-space: nowrap ; speak-header: always}
TD { Background-color: silver ; text-align: center ; padding-right: 9 ; padding-left: 9 ; border-style: Ridge ; white-space: nowrap; overflow: hidden }
U { color: blue }
table { border: inset 1px solid white ; border-style: Ridge }
B { Color: white }
H4 { Color: blue }
</Style>
<HTA:Application
ID = AdminScripts
Caption = Yes
Border = Thick
ShowInTaskBar = yes
MaximizeButton = Yes
MinimizeButton = Yes
SingleInstance = Yes />
<Script Language = VBScript>
'==================== CHANGE STUFF HERE TO MAKE THINGS WORK ==============
Set oShell = CreateObject("WScript.Shell")
strDomain = "mondomaine.local"
strSCCMSiteCode = "fk2"
strSCCMSiteServer = "server1"
strSMSSiteCode = "FK1"
strSMSSiteServer = "server1"
'==================== OK, THAT SHOULD DO IT ==============================
loggy = ""
runline = ""
' Connecting to DB servers just once so if run from a network share the user is only security prompted once.
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Chase referrals") = &H60
objCommand.Properties("Page Size") = 100
objCommand.Properties("Searchscope") = 2
objCommand.Properties("Timeout") = 50 'seconds
Sub WindowsLoad
loggy = loggy & vbcrlf & "Searching for " & machinename.value
document.all.log_box.InnerText = Loggy
On Error Resume Next
' Checking input
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
objRegEx.Pattern = "[^A-Za-z0-9._-]"
Set colMatches = objRegEx.Execute(machinename.value)
If colMatches.Count > 0 Then
entryerror = "The following characters are not allowed:" & vbcrlf
For Each strMatch in colMatches
entryerror = entryerror & " " & strMatch
Next
Alert(entryerror)
exit sub
End If
if len(machinename.value)<3 then
alert("Too short")
exit sub
end if
' Something to look at while the search is running
DataArea1.InnerHtml = "<br summary=" & chr(34) & "Searching" & chr(34) & "><br><H5>Searching Computers...</H5></font>"
DataArea2.InnerHtml = "<br><br><H5>Searching Users...</H5></font>"
DataArea3.InnerHtml = "<br><br><H5>Searching Printers...</H5></font>"
arg = MachineName.value
' Yummy Query Goodness
'printer
objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://" & strDomain & "' WHERE Name='*" & Arg & "*' and objectCategory='PrintQueue' order by Name"
Set objRecordSet = objCommand.Execute
'AD user
objCommand.CommandText = _
"<LDAP://" & strDomain & ">;(&(objectcategory=person)(samaccountname=*)(|(samaccountname=" & arg & "*)(sn=" & arg & "*)(givenname=" & arg & "*)));name,samaccountname,whenCreated,msExchHomeServerName"
Set objUserSet = objCommand.Execute
'Computers
Set objWMIService = GetObject("winmgmts://" & strSCCMSiteServer & "\root\sms\site_" & strSCCMSiteCode)
Set Computers = objWMIService.ExecQuery("Select * From SMS_R_system WHERE Name LIKE ""%" + arg + "%"" or IPAddresses LIKE ""%" + arg + "%"" or LastLogonUsername LIKE ""%" + arg + "%""",,48)
'Set Users = objWMIService.ExecQuery("Select * From SMS_R_User WHERE Name LIKE ""%" + arg + "%""",,48)
' Make it easy to find the query in the taskbar
Window.Document.Title = arg & " Search Results"
' Building the Table bodies based on the results of the search
' Computers go first
Ccount = 0
alert(Computers.Fields)
for each objProperty in Computers
Ccount = Ccount + 1
strHtml1 = strHtml1 & "<TR>" &_
"<TH scope=" & chr(34) & "row" & chr(34) & " tabindex = " & chr(34) & "0" & chr(34) & " >" & objProperty.Name & "</TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = Netdiag('" & objProperty.Name & "') onclick = Netdiag('" & objProperty.Name & "')><U>" & objProperty.IPAddresses(0) & "</U></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " >" & objProperty.LastLogonUserName &"</TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = RemoteSMS('" & objProperty.Name & "') onclick = RemoteSMS('" & objProperty.Name & "')><u>" & "RemoteSMS" & "</u></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = RemoteSCCM('" & objProperty.Name & "') onclick = RemoteSCCM('" & objProperty.Name & "')><u>" & "RemoteSCCM" & "</u></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = ShareC('" & objProperty.Name & "') onclick = ShareC('" & objProperty.Name & "')><u>" & "C" & "</u></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = Manage('" & objProperty.Name & "') onclick = Manage('" & objProperty.Name & "')><u>" & "Manage" & "</u></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = RemoteRun('" & objProperty.Name & "') onclick = RemoteRun('" & objProperty.Name & "')><u>" & "Run" & "</u></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = Reboot('" & objProperty.Name & "') onclick = Reboot('" & objProperty.Name & "')><u>" & "Reboot" & "</u></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = PrintGE('" & objProperty.Name & "') onclick = PrintGE('" & objProperty.Name & "')><u>" & "Global Printers" & "</u></TD>"
next
' Then Users
'UCount = 0
'for each objProp in Users
'Ucount = Ucount + 1
'strHtml2 = strHtml2 & "<TR>" &_
'"<TH scope=" & chr(34) & "row" & chr(34) & " tabindex = " & chr(34) & "0" & chr(34) & " >" & objProp.FullUserName & "</TD>" &_
'"<TD tabindex = " & chr(34) & "0" & chr(34) & " >" & objProp.UniqueUserName & "</TD>" &_
'"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = Unlock('" & objProp.UniqueUserName & "') onclick = Unlock('" & objProp.UniqueUserName & "')><u>" & " Unlock " & "</u></TD>" &_
'"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = ALS('" & objProp.UniqueUserName & "') onclick = ALS('" & objProp.UniqueUserName & "')><u>" & " Password " & "</U></TD></TR>"
'next
'AD Users
objUserSet.MoveFirst
UCount = 0
Do Until objUserSet.EOF
Ucount = Ucount + 1
strHtml2 = strHtml2 & "<TR>" &_
"<TH scope=" & chr(34) & "row" & chr(34) & " tabindex = " & chr(34) & "0" & chr(34) & " >" & objUserSet.Fields(0).Value & "</TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " >" & objUserSet.Fields(1).value & "</TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " >" & left(objUserSet.Fields(2).value,10) & "</TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " >" & Right(objUserSet.Fields(3).value,6) & "</TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = ALS('" & objUserSet.Fields(1).Value & "') onclick = ALS('" & objUserSet.Fields(1).Value & "')><u>" & " Password " & "</U></TD></TR>"
objUserSet.MoveNext
Loop
'Then Printers
' IP Address regular expression setup for printer port test.
objRegEx.Global = True
objRegEx.Pattern = "([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})"
objRecordSet.MoveFirst
Printercount = 0
Do Until objRecordSet.EOF
Printercount = printercount + 1
strPath = objRecordSet.Fields("ADsPath").Value
set Printer = GetObject(strPath)
Set colMatches = objRegEx.Execute(printer.PortName)
If colMatches.Count > 0 Then
For Each strMatch in colMatches
PrinterIP = strMatch
Next
End If
strHtml3 = strHtml3 & "<TR>" &_
"<TH scope=" & chr(34) & "row" & chr(34) & " tabindex = " & chr(34) & "0" & chr(34) & " >" & chr(92) & chr(92) & Printer.ShortServerName & chr(92) & Printer.printShareName & "</TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = Prndiag('" & PrinterIP & ":" & Printer.printShareName & "') onclick = Prndiag('" & PrinterIP & ":" & Printer.printShareName & "')><U>" & PrinterIP & "</U></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = PrintWeb('" & PrinterIP & "') onclick = PrintWeb('" & PrinterIP & "')><u>" & " Web Page " & "</u></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = PrintTP('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "') onclick = PrintTP('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "')><u>" & " Test Page " & "</u></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = PrintProps('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "') onclick = PrintProps('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "')><u>" & " Properties " & "</U></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = PrintQ('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "') onclick = PrintQ('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "')><u>" & " Queue " & "</U></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = PrintI('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "') onclick = PrintI('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "')><u>" & " Install " & "</U></TD>" &_
"<TD tabindex = " & chr(34) & "0" & chr(34) & " onkeypress = PrintU('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "') onclick = PrintU('" & Printer.printShareName & chr(44) & Printer.ShortServerName & "')><u>" & " Uninstall " & "</U></TD></TR>"
objRecordSet.MoveNext
Loop
' Only put a header on the table if there IS a table
if isempty(strhtml1) Then
else StrHtmlA = "<P><table name = " & chr(34) & "Computers" & chr(34) & " id='Computers' accesskey=" & chr(34) & "C" & chr(34) & " >" &_
"<TR><TH Colspan=10 tabindex = " & chr(34) & "0" & chr(34) & " >Computer Information</TH></TR>" &_
"<TR><TH scope=" & chr(34) & "col" & chr(34) & ">PC Name</TH><TH scope=" & chr(34) & "col" & chr(34) & ">IP Address</TH><TH scope=" & chr(34) & "col" & chr(34) & ">User Name</TH><TH scope=" & chr(34) & "col" & chr(34) & ">RemoteSMS</TH><TH scope=" & chr(34) & "col" & chr(34) & ">RemoteSCCM</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Drive</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Manage</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Run</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Reboot</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Global Printers</TH></TR>" & strhtml1
end if
if isempty(strhtml2) Then
else StrhtmlB = "<br><table name = " & chr(34) & "Users" & chr(34) & " id='Users' accesskey=" & chr(34) & "U" & chr(34) & ">" &_
"<TR><TH Colspan=20 tabindex = " & chr(34) & "0" & chr(34) & " >User Information</TH></TR>" &_
"<TR><TH scope=" & chr(34) & "col" & chr(34) & ">Name</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Username</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Created</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Mail</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Password</TH></TR>" & strhtml2
end if
if isempty(strhtml3) Then
else StrhtmlC = "<br><table name = " & chr(34) & "Printers" & chr(34) & " id='Printers' accesskey=" & chr(34) & "P" & chr(34) & ">" &_
"<TR><TH Colspan=8 tabindex = " & chr(34) & "0" & chr(34) & " >Printer Information</TH></TR>" &_
"<TR style=" & chr(34) & "max-height:1px" & chr(34) & "><TH scope=" & chr(34) & "col" & chr(34) & ">Printer Name</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Printer IP</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Printer Link</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Print Test Page</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Printer Properties</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Print Queue</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Install</TH><TH scope=" & chr(34) & "col" & chr(34) & ">Uninstall</TH></TR>" & strhtml3
end if
' Count the results
PCount = PrinterCount
StrHtmlR = "        Results: <A summary=" & chr(34) & "Press Alt C to Jump to the computers table " & CCount & " found, Press Alt U to Jump to the Users table " & UCount & " found, Press Alt P to Jump to the Printers table " & PCount & " found" & chr(34) & " href=" & chr(34) & "#Computers" & chr(34) & ">Computers = " & CCount & "</A>       <A href=" & chr(34) & "#Users" & chr(34) & ">Users = " & UCount & "</A>       <A href=" & chr(34) & "#Printers" & chr(34) & "> Printers = " & PCount & "</A>"
loggy = loggy & vbtab & "Found: " & Ccount & " Computers, " & Ucount & " Users, and " & PCount & " Printers." & vbcrlf
document.all.log_box.InnerText = Loggy
' Dump the results into the inner HTML for the sapns when we get around to making a web page
Results.InnerHTML = StrHtmlR
DataArea1.InnerHtml = StrHtmlA
DataArea2.InnerHtml = strHtmlB
DataArea3.InnerHtml = strHtmlC
' end the windowsload sub
End Sub
Function Pinging(Host)
set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select * from Win32_PingStatus where address = '" & Host & "'")
for each objRetStatus in objPing
if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
loggy = loggy & vbcrlf & "Ping to " & objretstatus.address & " failed. " & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
Pinging = False
else
loggy = loggy & vbcrlf & "Ping Succeeded." & " " & objretstatus.address & " Response time: " & objretstatus.responsetime & "ms Size: " & objretstatus.Replysize & " bits" & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
Pinging = True
end if
next
end Function
Function NetDiag(Host)
if Pinging(Host) = False then
exit Function
end if
loggy = loggy & vbcrlf & vbcrlf & "*************************************" & vbcrlf
loggy = loggy & "Gathering systeminfo for " & host & " at " & now() & vbcrlf
loggy = loggy & "*************************************" & vbcrlf
document.all.log_box.InnerText = Loggy
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec("systeminfo /s " & Host)
Set objStdOut = objWshScriptExec.StdOut
strOutput = objStdOut.ReadAll
'Cleaning out the hotfixes
strOutput = split(strOutput, vbcrlf)
strOutput = Filter(strOutput,"]: F", False,1)
strOutput = Filter(strOutput,"]: Q", False,1)
strOutput = Filter(strOutput,"]: K", False,1)
strOutput = Filter(strOutput,"]: M", False,1)
strOutput = Filter(strOutput,"]: w", False,1)
strOutput = Filter(strOutput,"]: S", False,1)
strOutput = Join(strOutput,vbcrlf)
loggy = loggy & strOutput
loggy = loggy & vbcrlf & vbcrlf & "*************************************" & vbcrlf
loggy = loggy & "Finished Gathering systeminfo for " & host & " at " & now() & vbcrlf
loggy = loggy & "*************************************" & vbcrlf
document.all.log_box.InnerText = Loggy
loggy = loggy & vbcrlf & vbcrlf & "*************************************" & vbcrlf
loggy = loggy & "Network latency check to " & host & " at " & now() & vbcrlf
loggy = loggy & "*************************************" & vbcrlf
document.all.log_box.InnerText = Loggy
Set objWshScriptExec = objShell.Exec("ping -w 500 -l 32767 -n 5 " & Host)
Set objStdOut = objWshScriptExec.StdOut
strOutput = objStdOut.ReadAll
strOutput = replace(strOutput, vbcrlf , "")
loggy = loggy & strOutput
loggy = loggy & vbcrlf & vbcrlf & "*************************************" & vbcrlf
loggy = loggy & "Finished network latency check to " & host & " at " & now() & vbcrlf
loggy = loggy & "*************************************" & vbcrlf
document.all.log_box.InnerText = Loggy
end Function
Function PrnDiag(Host)
Host = split(Host,":")
if Pinging(Host(0)) = False then
exit Function
end if
loggy = loggy & vbcrlf & vbcrlf & "*************************************" & vbcrlf
loggy = loggy & "Getting all Active Directory info for " & Host(1) & " at " & now() & vbcrlf
loggy = loggy & "*************************************" & vbcrlf
document.all.log_box.InnerText = Loggy
Set objShell = CreateObject("WScript.Shell")
runline = "dsquery * domainroot -limit 10 -filter " & chr(34) & "(&(objectClass=PrintQueue)(name=*" & Host(1) & "*))" & chr(34) & " -L -attr *"
Set objWshScriptExec = objShell.Exec(runline)
Set objStdOut = objWshScriptExec.StdOut
strOutput = objStdOut.ReadAll
loggy = loggy & strOutput
loggy = loggy & vbcrlf & vbcrlf & "*************************************" & vbcrlf
loggy = loggy & "Finished getting all Active Directory info for " & host(1) & " at " & now() & vbcrlf
loggy = loggy & "*************************************" & vbcrlf
document.all.log_box.InnerText = Loggy
loggy = loggy & vbcrlf & vbcrlf & "*************************************" & vbcrlf
loggy = loggy & "Performing pathping to " & host(0) & " at " & now() & vbcrlf
loggy = loggy & "*************************************" & vbcrlf
document.all.log_box.InnerText = Loggy
Set objWshScriptExec = objShell.Exec("pathping -p 20 -q 50 " & Host(0))
Set objStdOut = objWshScriptExec.StdOut
strOutput = objStdOut.ReadAll
strOutput = replace(strOutput, vbcrlf , "")
loggy = loggy & strOutput
loggy = loggy & vbcrlf & vbcrlf & "*************************************" & vbcrlf
loggy = loggy & "Finished pathping to " & host(0) & " at " & now() & vbcrlf
loggy = loggy & "*************************************" & vbcrlf
document.all.log_box.InnerText = Loggy
end Function
' Series of VB Scripts that are called by onclick events in the web page.
Sub RemoteSMS(arg1)
if Pinging(arg1) = False then
exit sub
end if
Set oShell = CreateObject("WScript.Shell")
Runline = "C:\SMSADMIN\AdminUI\bin\i386\remote.exe 2 " & arg1 & " \\" & strSMSSiteServer&"\"
loggy = loggy & "Remoting to " & arg1 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
Sub RemoteSCCM(arg1)
if Pinging(arg1) = False then
exit sub
end if
Set oShell = CreateObject("WScript.Shell")
Runline = "C:\SMSADMIN\AdminUI\bin\i386\rc.exe 1 " & arg1 & " \\" & strSCCMSiteServer&"\"
loggy = loggy & "Remoting to " & arg1 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
Sub Manage(arg2)
if Pinging(arg2) = False then
exit sub
end if
Set oShell = CreateObject("WScript.Shell")
Runline = "c:\windows\system32\mmc.exe c:\windows\system32\compmgmt.msc /computer=" & arg2
loggy = loggy & "Opening management window to " & arg2 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
Sub ShareC(arg3)
if Pinging(arg3) = False then
exit sub
end if
Set oShell = CreateObject("WScript.Shell")
Runline = "c:\windows\explorer.exe \\" & arg3 & "\c" & chr(36)
loggy = loggy & "Opening C: drive admin Share on " & arg3 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
sub Reboot(arg4)
if Pinging(arg4) = False then
exit sub
end if
Set oShell = CreateObject("WScript.Shell")
loggy = loggy & "Are you sure you want to reboot? "
document.all.log_box.InnerText = Loggy
retval = msgbox("Are you sure?", vbYesNo)
if retval = vbYes then
Runline = "c:\windows\system32\shutdown.exe -r -t 00 -f -c " & chr(34) & " Help Desk user rebooting this pc for troubleshooting purposes " & chr(34) & " -m \\" & arg4 & " -d p:4:1"
loggy = loggy & "Yes" & vbcrlf & "Rebooting PC " & arg4 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
else
loggy = loggy & "No" & vbcrlf
document.all.log_box.InnerText = Loggy
MsgBox("OK, Nevermind then")
end if
End Sub
Sub RemoteRun(arg5)
if Pinging(arg5) = False then
exit sub
end if
Set oShell = CreateObject("WScript.Shell")
Command = inputBox("Enter the command line to run", "Command Line")
if isempty(Command) then exit sub
if len(Command)<3 then
alert("Too short")
exit sub
end if
loggy = loggy & "Running command line: " & Command & " on " & arg5 & vbcrlf
document.all.log_box.InnerText = Loggy
Set objWMIService = GetObject _
("winmgmts:\\" & arg5 & "\root\cimv2:Win32_Process")
Error = objWMIService.Create(Command, null, null, intProcessID)
If Error = 0 Then
MsgBox(Command & " was started with a process ID of " & intProcessID & ".")
loggy = loggy & Command & " was started with a process ID of " & intProcessID & "." & vbcrlf
document.all.log_box.InnerText = Loggy
Else
MsgBox(Command & " could not be started due to error " & Error & ".")
loggy = loggy & Command & " could not be started due to error " & Error & "." & vbcrlf
document.all.log_box.InnerText = Loggy
End If
End Sub
Sub Unlock(arg6)
set objUser = GetObject("WinNT://" & strDomain & "/" & arg6)
if objUser.IsAccountLocked = 1 then
objUser.IsAccountLocked = 0
objUser.SetInfo
If err.number = 0 Then
Wscript.Echo "The account was unlocked succesfully"
Else
Wscript.Echo "Failed to unlock the account"
end if
else
MsgBox("Account not locked")
end if
end Sub
Sub ALS(arg7)
Set oShell = CreateObject("WScript.Shell")
Runline = "C:\Program Files\ALS\als.exe /u:" & strDomain & "\" & arg7
loggy = loggy & "Opening ALS for user " & arg7 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
end sub
Sub PrintTP(arg8)
arrarg8 = Split(arg8, ",")
Set oShell = CreateObject("WScript.Shell")
Runline = "RUNDLL32 printui.dll,PrintUIEntry /k /n\\" & arrarg8(1) & chr(92) & arrarg8(0)
loggy = loggy & "Printing test page on " & arg8 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
Sub PrintProps(arg9)
arrarg9 = Split(arg9, ",")
Set oShell = CreateObject("WScript.Shell")
Runline = "RUNDLL32 printui.dll,PrintUIEntry /p /n\\" & arrarg9(1) & chr(92) & arrarg9(0)
loggy = loggy & "Opening Printer properties window for " & arg9 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
Sub PrintQ(arg10)
arrarg10 = Split(arg10, ",")
Set oShell = CreateObject("WScript.Shell")
Runline = "RUNDLL32 printui.dll,PrintUIEntry /o /n\\" & arrarg10(1) & chr(92) & arrarg10(0)
loggy = loggy & "Opening Print Queue for " & arg10 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
Sub PrintI(arg11)
Set oShell = CreateObject("WScript.Shell")
arrarg11 = Split(arg11, ",")
PCName = InputBox("Please Enter the full name of the Computer: e.g. PC36")
if len(PCName)<3 then
exit sub
end if
if Pinging(pcname) = False then
exit sub
end if
Runline = "RUNDLL32 printui.dll,PrintUIEntry /ga /n\\" & arrarg11(1) & chr(92) & arrarg11(0) & " /c\\" & PCName
loggy = loggy & "Installing printer: " & arg11 & " on PC: " & PCName & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
T = Timer + 1
Do until T < Timer
Loop
Runline = "SC \\" & PCName & " stop spooler"
loggy = loggy & "stopping Spooler on PC: " & PCName & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
T = Timer + 1
Do until T < Timer
Loop
Runline = "SC \\" & PCName & " start spooler"
loggy = loggy & "starting Spooler on PC: " & PCName & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
Sub PrintU(arg12)
Set oShell = CreateObject("WScript.Shell")
arrarg12 = Split(arg12, ",")
PCName = InputBox("Please Enter the full name of the Computer: e.g. PC36")
if len(PCName)<3 then
exit sub
end if
if Pinging(pcname) = False then
exit sub
end if
Runline = "RUNDLL32 printui.dll,PrintUIEntry /gd /n\\" & arrarg12(1) & chr(92) & arrarg12(0) & " /c\\" & PCName
loggy = loggy & "Uninstalling printer: " & arg12 & " from PC: " & PCName & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
T = Timer + 1
Do until T < Timer
Loop
Runline = "SC \\" & PCName & " stop spooler"
loggy = loggy & "stopping Spooler on PC: " & PCName & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
T = Timer + 2
Do until T < Timer
Loop
Runline = "SC \\" & PCName & " start spooler"
loggy = loggy & "starting Spooler on PC: " & PCName & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
Sub PrintGE(arg13)
if Pinging(arg13) = False then
exit sub
end if
arrarg13 = Split(arg13, ",")
Set oShell = CreateObject("WScript.Shell")
Runline = "RUNDLL32 printui.dll,PrintUIEntry /ge /c\\" & arg13
oShell.exec(Runline)
End Sub
Sub PrintWeb(arg14)
Set oShell = CreateObject("WScript.Shell")
Runline = "c:\windows\explorer.exe http://" & arg14
loggy = loggy & "Opening web page: http://" & arg14 & " by running the following command: " & vbcrlf & vbtab & runline & vbcrlf
document.all.log_box.InnerText = Loggy
oShell.exec(Runline)
End Sub
' Puts the focus on the search box
Sub window_onload
' Accepts command line argument
MachineName.focus()
arrCommands = Split(Adminscripts.commandLine, chr(34))
arrCommands(2) = TRIM(arrCommands(2))
if (arrCommands(2)) = "" then
exit sub
else
machinename.value = arrCommands(2)
Windowsload
end if
End Sub
Sub append
loggy = log_box.value
end sub
Sub CopyToClip
document.parentwindow.clipboardData.SetData "text", log_box.value
End Sub
Sub ClearWindow
log_box.value = ""
loggy = ""
End Sub
</Script>
<Body>
Search: <Input Type = "text" Name = "MachineName" Alt = "Search string">
<Input Type = "submit" Value = "Go" Name = "Run_Button" onClick = "WindowsLoad">
<Span ID="Results"></SPAN>
<Span Id="DataArea1"><br><br>To find<B> COMPUTER </B> information please enter <i>full or partial</i>:<BR>        PC Name<BR>        IP Address<BR>        Login Name of last user to login </Span>
<Span Id="DataArea2"><br><br>To find<B> USER </B>information please enter <i>full or partial</i>:<BR>        First Name<BR>        Last Name<BR>        Login Name </font></Span>
<Span Id="DataArea3"><br><br>To find<B> PRINTER </B>information please enter <i>full or partial</i>:<BR>        Printer Name </Span>
<Div Align = "Center">
<P>
<Input Type = "button" Value = "Copy to Clipboard... Copy to Clipboard..." Name = "CopyButton" onClick = "CopyToClip"><BR>
<textarea wrap="off" name="loggy" rows="10" cols=70 id="log_box" onChange=append ></textarea><BR>
<Input Type = "button" Value = "Clear the Window... Erase all that work... Wipe the slate..." Name = "ClearButton" onClick = "ClearWindow"><BR>
</P>
<P><font color="#333333">Created By ghangas
</Body> |
Partager