Tuesday, October 16, 2012

Good Cmd Commands

Basic Commands in the Command Line



   ADDUSERS Add or list users to/from a CSV file
   ADmodcmd Active Directory Bulk Modify
   ARP      Address Resolution Protocol
   ASSOC    Change file extension associations•
   ASSOCIAT One step file association
   ATTRIB   Change file attributes
b
   BCDBOOT  Create or repair a system partition
   BCDEDIT  Manage Boot Configuration Data
   BITSADMIN Background Intelligent Transfer Service
   BOOTCFG  Edit Windows boot settings
   BROWSTAT Get domain, browser and PDC info
c
   CACLS    Change file permissions
   CALL     Call one batch program from another•
   CERTREQ  Request certificate from a certification authority
   CD       Change Directory - move to a specific Folder•
   CHANGE   Change Terminal Server Session properties
   CHKDSK   Check Disk - check and repair disk problems
   CHKNTFS  Check the NTFS file system
   CHOICE   Accept keyboard input to a batch file
   CIPHER   Encrypt or Decrypt files/folders
   CleanMgr Automated cleanup of Temp files, recycle bin
   CLEARMEM Clear memory leaks
   CLIP     Copy STDIN to the Windows clipboard
   CLS      Clear the screen•
   CLUSTER  Windows Clustering
   CMD      Start a new CMD shell
   CMDKEY   Manage stored usernames/passwords
   COLOR    Change colors of the CMD window•
   COMP     Compare the contents of two files or sets of files
   COMPACT  Compress files or folders on an NTFS partition
   COMPRESS Compress individual files on an NTFS partition
   CON2PRT  Connect or disconnect a Printer
   CONVERT  Convert a FAT drive to NTFS
   COPY     Copy one or more files to another location•
   CSCcmd   Client-side caching (Offline Files)
   CSVDE    Import or Export Active Directory data 
d
   DATE     Display or set the date•
   DEFRAG   Defragment hard drive
   DEL      Delete one or more files•
   DELPROF  Delete user profiles
   DELTREE  Delete a folder and all subfolders
   DevCon   Device Manager Command Line Utility 
   DIR      Display a list of files and folders•
   DIRUSE   Display disk usage
   DISKPART Disk Administration
   DISKSHADOW Volume Shadow Copy Service
   DNSSTAT  DNS Statistics
   DOSKEY   Edit command line, recall commands, and create macros
   DriverQuery Display installed device drivers
   DSACLs   Active Directory ACLs
   DSAdd    Add items to active directory (user group computer) 
   DSGet    View items in active directory (user group computer)
   DSQuery  Search for items in active directory (user group computer)
   DSMod    Modify items in active directory (user group computer)
   DSMove   Move an Active directory Object
   DSRM     Remove items from Active Directory
e
   ECHO     Display message on screen•
   ENDLOCAL End localisation of environment changes in a batch file•
   ERASE    Delete one or more files•
   EVENTCREATE Add a message to the Windows event log
   EXIT     Quit the current script/routine and set an errorlevel•
   EXPAND   Uncompress files
   EXTRACT  Uncompress CAB files
f
   FC       Compare two files
   FIND     Search for a text string in a file
   FINDSTR  Search for strings in files
   FOR /F   Loop command: against a set of files•
   FOR /F   Loop command: against the results of another command•
   FOR      Loop command: all options Files, Directory, List•
   FORFILES Batch process multiple files
   FORMAT   Format a disk
   FREEDISK Check free disk space (in bytes)
   FSUTIL   File and Volume utilities
   FTP      File Transfer Protocol
   FTYPE    File extension file type associations•
g
   GETMAC   Display the Media Access Control (MAC) address
   GLOBAL   Display membership of global groups
   GOTO     Direct a batch program to jump to a labelled line•
   GPRESULT Display Resultant Set of Policy information
   GPUPDATE Update Group Policy settings
h
   HELP     Online Help
i
   iCACLS   Change file and folder permissions
   IF       Conditionally perform a command•
   IFMEMBER Is the current user a member of a Workgroup
   IPCONFIG Configure IP
k
   KILL     Remove a program from memory
l
   LABEL    Edit a disk label
   LOCAL    Display membership of local groups
   LOGEVENT Write text to the event viewer
   LOGMAN   Manage Performance Monitor
   LOGOFF   Log a user off
   LOGTIME  Log the date and time in a file
m
   MAPISEND Send email from the command line
   MBSAcli  Baseline Security Analyzer
   MEM      Display memory usage
   MD       Create new folders•
   MKLINK   Create a symbolic link (linkd)
   MODE     Configure a system device
   MORE     Display output, one screen at a time
   MOUNTVOL Manage a volume mount point
   MOVE     Move files from one folder to another•
   MOVEUSER Move a user from one domain to another
   MSG      Send a message
   MSIEXEC  Microsoft Windows Installer
   MSINFO32 System Information
   MSTSC    Terminal Server Connection (Remote Desktop Protocol)
   MV       Copy in-use files
n
   NET      Manage network resources
   NETDOM   Domain Manager
   NETSH    Configure Network Interfaces, Windows Firewall & Remote access
   NETSVC   Command-line Service Controller
   NBTSTAT  Display networking statistics (NetBIOS over TCP/IP)
   NETSTAT  Display networking statistics (TCP/IP)
   NOW      Display the current Date and Time 
   NSLOOKUP Name server lookup
   NTBACKUP Backup folders to tape
   NTRIGHTS Edit user account rights
o
   OPENFILES Query or display open files
p
   PATH     Display or set a search path for executable files•
   PATHPING Trace route plus network latency and packet loss
   PAUSE    Suspend processing of a batch file and display a message•
   PERMS    Show permissions for a user
   PERFMON  Performance Monitor
   PING     Test a network connection
   POPD     Return to a previous directory saved by PUSHD•
   PORTQRY  Display the status of ports and services
   POWERCFG Configure power settings
   PRINT    Print a text file
   PRINTBRM Print queue Backup/Recovery
   PRNCNFG  Display, configure or rename a printer
   PRNMNGR  Add, delete, list printers set the default printer
   PROMPT   Change the command prompt•
   PsExec     Execute process remotely
   PsFile     Show files opened remotely
   PsGetSid   Display the SID of a computer or a user
   PsInfo     List information about a system
   PsKill     Kill processes by name or process ID
   PsList     List detailed information about processes
   PsLoggedOn Who's logged on (locally or via resource sharing)
   PsLogList  Event log records
   PsPasswd   Change account password
   PsPing     Measure network performance
   PsService  View and control services
   PsShutdown Shutdown or reboot a computer
   PsSuspend  Suspend processes
   PUSHD    Save and then change the current directory•
q
   QGREP    Search file(s) for lines that match a given pattern
   Query Process    Display processes (TS/Remote Desktop)
   Query Session    Display all sessions (TS/Remote Desktop)
   Query TermServer List all servers (TS/Remote Desktop)
   Query User       Display user sessions (TS/Remote Desktop)
r
   RASDIAL  Manage RAS connections
   RASPHONE Manage RAS connections
   RECOVER  Recover a damaged file from a defective disk
   REG      Registry: Read, Set, Export, Delete keys and values
   REGEDIT  Import or export registry settings
   REGSVR32 Register or unregister a DLL
   REGINI   Change Registry Permissions
   REM      Record comments (remarks) in a batch file•
   REN      Rename a file or files•
   REPLACE  Replace or update one file with another
   Reset Session  Delete a Remote Desktop Session
   RD       Delete folder(s)•
   RMTSHARE Share a folder or a printer
   ROBOCOPY Robust File and Folder Copy
   ROUTE    Manipulate network routing tables
   RUN      Start | RUN commands
   RUNAS    Execute a program under a different user account
   RUNDLL32 Run a DLL command (add/remove print connections)

s
   SC       Service Control
   SCHTASKS Schedule a command to run at a specific time
   SCLIST   Display Services
   SET      Display, set, or remove session environment variables•
   SETLOCAL Control the visibility of environment variables•
   SETX     Set environment variables
   SFC      System File Checker 
   SHARE    List or edit a file share or print share
   ShellRunAs Run a command under a different user account
   SHIFT    Shift the position of batch file parameters•
   SHORTCUT Create a windows shortcut (.LNK file)
   SHOWGRPS List the Workgroups a user has joined
   SHOWMBRS List the Users who are members of a Workgroup
   SHUTDOWN Shutdown the computer
   SLEEP    Wait for x seconds
   SLMGR    Software Licensing Management (Vista/2008)
   SOON     Schedule a command to run in the near future
   SORT     Sort input
   START    Start a program, command or batch file•
   SU       Switch User
   SUBINACL Edit file and folder Permissions, Ownership and Domain
   SUBST    Associate a path with a drive letter
   SYSTEMINFO List system configuration
t
   TAKEOWN  Take ownership of a file
   TASKLIST List running applications and services
   TASKKILL Remove a running process from memory
   TIME     Display or set the system time•
   TIMEOUT  Delay processing of a batch file
   TITLE    Set the window title for a CMD.EXE session•
   TLIST    Task list with full path
   TOUCH    Change file timestamps    
   TRACERT  Trace route to a remote host
   TREE     Graphical display of folder structure
   TSSHUTDN Remotely shut down or reboot a terminal server
   TYPE     Display the contents of a text file•
   TypePerf Write performance data to a log file
u
   USRSTAT  List domain usernames and last login
v
   VER      Display version information•
   VERIFY   Verify that files have been saved•
   VOL      Display a disk label•
w
   WAITFOR  Wait for or send a signal
   WHERE    Locate and display files in a directory tree
   WHOAMI   Output the current UserName and domain
   WINDIFF  Compare the contents of two files or sets of files
   WINMSDP  Windows system report
   WINRM    Windows Remote Management
   WINRS    Windows Remote Shell
   WMIC     WMI Commands
   WUAUCLT  Windows Update
x
   XCACLS   Change file and folder permissions
   XCOPY    Copy files and folders
   ::       Comment / Remark•

Creating Camera Presets in Lenel Virtual Matrix



Creating Camera Presets in Lenel Virtual Matrix


FROM LENEL TECHNICAL SUPPORT:

Requirements

1)    LDVR environment
2)    Virtual Matrix Switch “Pelco D” protocol
3)    OnGuard Version 5.11.105 and later releases
4)    Camera Pelco Spectra Dome II or  III

Currently Lenel's GUI has no support for "set preset" command.  Originally, setting presets was done via matrix switcher's UI.  In the case of virtual matrix switcher, there is no UI.  The workaround is to temporarily replace the "go to preset" command with "set preset" command.  Thus typing the preset number and clicking the "go to preset" button will actually set the preset to the current position.

Process

Step 1

Configure Virtual Matrix and PTZ camera. Before proceeding to step 2. you have to be able to PTZ the camera through your mouse/keyboard via Alarm Monitoring.



Step 2 

Open System Administration ,Matrix Switch, Select “Pelco D Protocol” (Picture below is just example be sure to select Pelco “D” Protocol.




Please insert this string to Go To Preset Command:

<\255><%b><\000><\003><\000><%t><%x>


 Step 3

Go to Alarm Monitoring and create preset by navigating with mouse/keyboard and select preset points. Then type number or letter.(see below) and then click on icon below “Go to or set preset”  and click on it once complete.


 

Step 4

Open System Admin Matrix Switch, Select Pelco D Protocol

Please insert this string to Go To Preset Command:

<\255><%b><\000><\007><\000><%t><%x>


Step 5

Open Alarm Monitoring and type the preset number or letter that you created in Step 3, Then “Goto or Set preset” Icon. This will take you to the preset point that you created.

Whats my ip address?



What Is My IP Address? Who Knows?


Recently a customer asked for the ability to view their cameras remotely using an iPad.  No problem.  But, from a remote site the customer needs to know the public internet address of their video serverThere are a couple of free internet sites that can help with this.  Here's how:

1.  Go to the Video Server and open an internet browser.

2.  Navigate to www.whatsmyip.org

The site opens and displays the system's public IP address at the top.

3.  Use this address to configure the remote viewing software .

Also, when configuring remote viewing software you may have to specify a TCP Port to use in addition to the IP address.  This site includes a port scanning tool to determine if the port you need is open or if it is being blocked.  It displays the status of common ports and you can perform a custom port test and specify the port you need.

Here are some other sites:


http://www.whatismyip.com/


http://www.canyouseem.com

Scheduling Automatic Backups in SLQ



Schedule Automated Backups of SQL Database

From Article 1131 in the Lenel Knowledgebase

This refers to SQL Server 2005 Express, but has been successfully tested with 2008.

To back up an SQL Server database on a time schedule for an SQL Server 2005 Express system:

1) Create a folder named SQLBackup in the C:\ drive. 

2) Copy the following code, and then start Notepad. Paste the text into Notepad.

=============================================
DECLARE @BackupFile varchar(255), @DB varchar(30), @Description varchar(255), @LogFile varchar(50)
DECLARE @Name varchar(30), @MediaName varchar(30), @BackupDirectory nvarchar(200)
SET @BackupDirectory = 'C:\SQLBackup\'
Add a list of all databases you don't want to backup to this.
DECLARE Database_CURSOR CURSOR FOR SELECT name FROM sysdatabases WHERE name <> 'tempdb' AND name <> 'model' AND name <> 'Northwind' AND name <> 'master' AND name <> 'msdb'
OPEN Database_Cursor
FETCH next FROM Database_CURSOR INTO @DB
WHILE @@fetch_status = 0
    BEGIN
     SET @Name = @DB + '( Daily BACKUP )'
     SET @MediaName = @DB + '_Dump' + CONVERT(varchar, CURRENT_TIMESTAMP , 112)
     SET @BackupFile = @BackupDirectory + CONVERT(varchar, CURRENT_TIMESTAMP , 112) + "_" + @DB + '_' + 'Full' + '_' +
      '.bak'
     SET @Description = 'Normal' + ' BACKUP at ' + CONVERT(varchar, CURRENT_TIMESTAMP) + '.'
     IF (SELECT COUNT(*) FROM msdb.dbo.backupset WHERE database_name = @DB) > 0 OR @DB = 'master'
      BEGIN
       SET @BackupFile = @BackupDirectory + CONVERT(varchar, CURRENT_TIMESTAMP , 112) + "_"+ @DB + '_' + 'Full' + '_' + '.bak'
       SET some more pretty stuff for sql server.
       SET @Description = 'Full' + ' BACKUP at ' + CONVERT(varchar, CURRENT_TIMESTAMP) + '.'
      END
     ELSE
      BEGIN
       SET @BackupFile = @BackupDirectory + @DB + '_' + 'Full' + '_' +
        CONVERT(varchar, CURRENT_TIMESTAMP , 112) + '.bak'
       SET some more pretty stuff for sql server.
       SET @Description = 'Full' + ' BACKUP at ' + CONVERT(varchar, CURRENT_TIMESTAMP) + '.'
      END
      BACKUP DATABASE @DB TO DISK = @BackupFile
      WITH NAME = @Name, DESCRIPTION = @Description ,
      MEDIANAME = @MediaName, MEDIADESCRIPTION = @Description ,
      STATS = 10
     FETCH next FROM Database_CURSOR INTO @DB
END
CLOSE Database_Cursor
DEALLOCATE Database_Cursor
=============================================
3) From the File menu, select Save.

4) In the Save as type drop-down, select "All Files".

5) In the File name field type backup.sql. Save this file to the C:\SQLBackup folder.
6) Copy the following code, and then paste the text into Notepad.

=============================================
sqlcmd -S . -i "C:\SQLBackup\Backup.sql"
=============================================
7) From the File menu, select Save.

8) In the Save as type drop-down, select "All Files".

9) In the File name field type backup.bat. Save this file to the C:\SQLBackup folder.

10) Open Schedule Tasks in Windows (Click the Start button, then select All Programs > Accessories > System Tools > Scheduled Tasks).

11) Double-click Add Scheduled Task. The Scheduled Task Wizard opens.

12) Click [Next] on the first window.

13) On the window where you select the program you want Windows to run, click [Browse]. Navigate to the C:\SQLBackup\backup.bat file, and then click [Open].

14) Type a name for the task, select how frequently to perform the task, and then click [Next].

15) Select the time and day you want the task to start, along with the day(s) of the week to run the task. Click [Next].

16) Enter the Windows login (which is required), and then click [Next].

17) Click [Finish].
18) To test the schedule, right-click on the schedule in Scheduled Tasks and select Run. If the backup runs successfully, a Date_AccessControl.bak file will be created in the C:\SQLBackup folder.

Default Address and Logins



Default Addresses and Logins

Lenel Access Control Panels

192.168.0.251    Login  user: admin  password:  password

Axis Cameras

192.168.0.90      Login  user: root  password:  pass

S2 Access Control Panels

192.168.0.250   Login  user: admin  password:  admin 

SQL Server Memory Settings



SQL Server Memory Settings

 
The fix was to limit the amount of memory that can be used by SQL Server.  The Lenel installation guide for SQL Server standard edition tells you to limit the memory and how to do it.  Microsoft explains this behavior and says it is “normal.”


“When you start SQL Server, SQL Server memory usage may continue to steadily increase and not decrease, even when activity on the server is low. Additionally, the Task Manager and Performance Monitor may show that the physical memory

Changing SQL SA Passwords



Lenel SA and SA Passwords

Lenel OnGuard uses two SA passwords.  The first SA account is within Microsoft SQL.  And the second SA account is in the Lenel database.  Very often, when we do a version upgrade on the Lenel OnGuard software these passwords are not known.  Here's how to handle both passwords:

Microsoft SQL

If this is an existing installation of OnGuard, use Windows Authentication when logging into the SQL Server Management Studio.

Open the Security folder.
Open the Logins folder.
Select the SA account.
Right-click the SA account and select Properties.
Change the password.

Now you can use the SQL SA account to log in or to perform the upgrade.

Lenel OnGuard

Login to SQL Server Management Studio.
Open Databases folder.
Select AccessControl database.
Right-Click the database and select New Query.
In the query window type the following command:
    update users set logonpwd=null where userid = -1
Press F5 to execute the query.
This command changes the Lenel SA account password to a blank password

Axis Camera Firmware Upgrade



Axis Camera Firmware Upgrade

HTTP
  1. Download the upgrade file to a directory that is accessible from your local computer.
  2. Go to the product's start page (e.g. http://192.168.0.90).
  3. Click the Setup link and log in as root (or any other user with Administrator privileges) if you are prompted for a username and password.
  4. You must be logged in as an Administrator to upgrade the unit.
  5. Click System Options in the menu to the left.
  6. Click Maintenance.
  7. Click the Browse button in the Upgrade Server section.
  8. Select the upgrade file you downloaded (and maybe decompressed) from www.axis.com
  9. Click the Open button.
  10. Click the Upgrade button in the Upgrade Server section.
  11. Wait for the flash load to complete, which may take 1-10 minutes.
The upgrade procedure is in four steps. The LEDs indicate the progress of the upgrade procedure, please refer to the user's manual for a description of the power, status and network LED indicators:
 Step 1:Shut down Running applications are shut down and active connections are terminated.
 Step 2:Upload firmwareThe old firmware will be erased and the new firmware will be saved. After a while, the progress of the upgrade will be displayed in the web browser.
Step 3:Reboot The system restarts automatically.
 Step 4:ReconfigurationThe new firmware settings are configured to match the previous settings.
After the upgrade has completed, the unit will automatically initiate the system

Windows 7 and Servers 2008 Blocks By Default



Windows 7 and Server 2008 Blocks by Default


Windows 7 and Server 2008 are built by default to block the installation of software (and other administrative tasks) and to block communication to and from the server.  There are a few adjustments which must be made in order to change this behavior.

1.  There is an added control of user accounts in these operating systems called User Account Control.  User Account Control will block the installation of software for any user except THE Administrator.  This includes any other user even if part of the administrator’s group.  And the software may appear to install correctly, but it is not installed correctly.  If installed by THE Administrator the software will correctly install but any other user will not be able to run the software.

FIX:  User Account Control must be turned off using a vertical slider bar.  This control is found in the User Accounts applet in the Control Panel.  There is a link for User Account Control.  Move the slider bar to the bottom and this will turn off the feature.

2.  In Server 2008 especially, there are 3 firewalls in some of our servers.  There is a Domain, Public, and Private firewall.  All three may need to be turned off in order for communication between the server and clients to operate.  If not turned off, then exceptions must be applied for the security applications.

FIX:  Use the Firewall applet in Control Panel to control the Firewalls.

3.  ICMP is a common network protocol.  It is used when the PING command is executed to determine network connectivity.  Server 2008 turns off ICMP.  So even when the network is fine, you may not be able to ping the server.  We have actually blamed the customer’s network for blocking communication and this was not true.  Other needed protocols are also turned off, like HTTP.

FIX:  This is also found in the firewall settings and policies.  Server 2008 provides an interface almost like a hardware based firewall where you can open or close inbound or outbound HTTP traffic.  Adjust these settings for your particular application.  But at least turn on ICMP in the server before

Control Panel Input Supervision



Control Panel Input Supervision

Rob Dennis reminds us to be aware of the type and configuration of control panel input supervision.  Discrete resistors or "resistor packs" can be used to supervise inputs.  The wiring configuration and values vary from one system to another.  Below are some common types of supervision.  Always use a multimeter to verify the correct values will be seen at the panel.

ANDOVER 


LENEL AND GE SECURITY

Lenel License Administration



Lenel License Administration

How to Discover Which Clients Are Connected to OnGuard Applications/Using Licenses
In License Administration, you see application names followed by the “In Use/Max.” column.
The screen shots below, for example, show that the System Administration Application (STD) has a “Max.” of 1 concurrent connections and 1 is currently “In Use.”




















If you click the “In Use” number (1 in this case), you will get a popup window that displays the hostnames and IP addresses of the clients using System Administration.
An example of this screen is below.
This popup also provides the ability to revoke a specific host’s use of the application.