Category - Shell
Contents Under Construction


Contents:
bar1
Customized Windows Service Reporting

bar1


Δ
Install INFs From The Command Line
Written by Eddie Jackson on Day, 11/xx/2009 xx:xx:00 PM [filed under Shell]
bar1


For my reference:

How to install INFs from the command line.

rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 .\.inf


bar1
Δ

bar1



 

Δ How To Create Hidden Launch Using Batch
Written by Eddie Jackson on Day, 11/03/2009 xx:xx:00 PM [filed under Shell]
bar1

Everyone has needed at one time or another the ability to launch a large batch file setup...however, you couldn't seem to get rid of the infamous console window, the command prompt, the "DOS" window. This is how you would change the security context and launch your main process called MAIN.CMD completely hidden. Note: you could have easily used only VBScript with the sanur.exe to also make this completely silent.


bar1
Here are our specs:
Change security context
Launch a batch file silently
bar1


@ECHO OFF
@REM Script Language: Shell
@REM Author: Eddie Jackson
@REM Date: 11/21/09
@REM Purpose: Proof of concept for silent batch file


Echo Set objShell = CreateObject("WScript.Shell") > %temp%\hidden.vbs
Echo objShell.Run "MAIN.CMD", 0 >> %temp%\hidden.vbs

@runas /u:administrator "wscript %temp%\hidden.vbs" | sanur.exe PASSWORD


bar1
Δ

bar1

 



Δ Customized Windows Service Reporting
Written by Eddie Jackson on Saturday, 08/15/2009 10:38:00 AM [filed under Shell & Reporting]
bar1

Okay, there are really many ways to query for an existing Windows service. But our script specs will entail a few extra details, making coding the script a little bit time consumeing in VBScripting alone.

bar1
Here are our specs:



Query for the dameware service
Output results in real-time to screen
Output results to log file
Log if workstation is offline
Must be coded and report compiled in 1 day
bar1

The specs are plenty easy with enough time, however, due to the timeline, we must throw something together quickly and get to reporting. What we end up coding is a 2 part script: The first part is a batch script (which saves a lot of scripting time) that loops through a text file containing the target workstations, does error handling, and outputs in real-time to screen. And secondly, a VBScript that queries the dameware service via a WMI routine and outputs results to
log.

 

@rem ******************************************************************************************
@rem Script Language: Batch Shell
@rem Script Name: _RUNME TO CREATE DAMEWARE LOG.BAT
@rem Purpose: TO COMPILE REPORT WITH WORKSTATIONS THAT HAVE THE DAMEWARE SERVICE RUNNING
@rem Creation Date: 08/11/09
@rem Last Modified: 08/12/09
@rem Author: EDDIE JACKSON
@rem E-Mail: EDDIE.JACKSON@halifax.org
@rem *********************************************************


@ECHO off

CLS

@COPY /Y "\\PathTo\COMPUTERS.TXT" C:\

@COPY /Y "\\PathTo\damewareservice.vbs" C:\

@color 0a

@title=Querying Dameware Service...

For /F "tokens=1" %%a in (C:\computers.txt) do set PC=%%a& call :REMOTE

Pause

@REM ERRORTRAPPING AND OFFLINE LOGGING INTO LOG.TXT

:REMOTE

IF EXIST "\\%PC%\C$\BOOT.INI" GOTO NEXT ;ERRORTRAPPING

IF NOT EXIST "\\%PC%\C$\BOOT.INI" GOTO ERR ;ERRORTRAPPING

@REM BEGIN QUERYING FOR DAMEWARE SERVICE

:NEXT

Echo Querying %PC% for Dameware Service

sc.exe \\%PC% getdisplayname "dwmrcs"

echo.

echo.

Echo Querying %PC% for Dameware Service >> c:\Dameware_Log_Raw_Data.txt

sc.exe \\%PC% getdisplayname "dwmrcs" >> c:\Dameware_Log_Raw_Data.txt

echo. >> c:\Dameware_Log_Raw_Data.txt

echo. >> c:\Dameware_Log_Raw_Data.txt

@REM This runs the VBScript WMI Query

wscript.exe c:\damewareservice.vbs %PC%

GOTO END

@REM THIS IS THE OFFLINE LOGGING

:ERR

Echo %PC% is not online

Echo %PC%, is not online >> c:\Dameware_Log.txt

@REM DONE

:END

 

‘ *****************************************************

Script Language: VBScript
Script Name: damewareservice.vbs

‘ Purpose: QUERIES DAMEWARE SERVICE VIA WMI

‘ Creation Date: 08/11/09

‘ Last Modified: 08/12/09

‘ Author: EDDIE JACKSON

‘ E-Mail: EDDIE.JACKSON@halifax.org

‘ *****************************************************


On error resume next

args = WScript.Arguments.Count

strComputer = WScript.Arguments.Item(0)

'''WScript.Echo strComputer

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colListOfServices = objWMIService.ExecQuery _

("Select * from Win32_Service Where Name = 'DWMRCS'")

For Each objService in colListOfServices

'''WScript.Echo "Service DOES Exist"

Const ForAppending1 = 8

'This creates the object

Set objFSO = CreateObject("Scripting.FileSystemObject")

'This sets the LogFile

Set objLogFile1 = objFSO.OpenTextFile("c:\Dameware_Log.txt", ForAppending1, True)

'This writes to the test file

Set objNetwork = CreateObject("WScript.Network")

objLogFile1.WriteLine Date() & "," & Time() & "," & strComputer & "," & "Dameware Service Installed"

'This closes the input

objLogFile1.Close

Next



bar1
Δ (doc) * (pdf) * email
bar1

































 


..About

..I'm a Computer  
..Systems Engineer


..L
iving and loving life

........................................


..Author
....




..Categories

....< AD
....< Exchange 
....< SQL
....< Windows
....< VBScript
....< Shell
....
<
Javascript
....< HTA
....< PowerShell
....< Reporting
....< Healthcare
....< Networking
....< General



..
Archives


....< November 2009
....<
October 2009
....<
September 2009

....
<
August 2009
....< July 2009