Tagarchief: Windows

How to check connection between windows and anywhere usb with nagios

The easiest way to monitor the connection between your Digi Anywhere USB device and a server is to monitor the USB device connected it. I use Nagios to monitor several indicators in each server, and the following script can be used to monitor if USB devices are connected:

strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDevices = objWMIService.ExecQuery ("Select * From Win32_USBControllerDevice")
 
For Each objDevice in colDevices
    strDeviceName = objDevice.Dependent
    strQuotes = Chr(34)
    strDeviceName = Replace(strDeviceName, strQuotes, "")
    arrDeviceNames = Split(strDeviceName, "=")
    strDeviceName = arrDeviceNames(1)
    Set colUSBDevices = objWMIService.ExecQuery ("Select * From Win32_PnPEntity Where DeviceID = '" & strDeviceName & "'")
    For Each objUSBDevice in colUSBDevices
        'Wscript.Echo objUSBDevice.Description
        If objUSBDevice.Description="SCR3311 USB Smart Card Reader" Then
           WScript.Echo "OK - Card reader detected"
           WScript.Quit 0
        End If
    Next
Next
 
WScript.Echo "WARNING - No card reader detected"
WScript.Quit 1

In my case, I monitor a card reader that identifies as "SCR3311 USB Smart Card Reader". You should type the exact name of the device you're monitoring at that spot. If you don't know the exact name of the device, uncomment the line
'Wscript.Echo objUSBDevice.Description
and then execute
cscript //nologo //t:10 "check_cardreader.vbs"

Put above file in c:\program files (x86)\nrpe\check_cardreader.vbs and update nrpe.cfg to contain:
command[check_cardreader]=cscript //nologo //t:10 "c:\program files (x86)\nrpe\check_cardreader.vbs"

After restarting the NRPE service, you're ready to monitor the USB device.

© GeekLabInfo How to check connection between windows and anywhere usb with nagios is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Windows 7: Using symbolic links

Linux and unix have had this nifty little feature called symlinks (symbolic links) for decades. Windows has finally caught up with the new command mklink.

Windows Vista introduced the new command mklink, which was expanded in Windows 7.

Syntax

MKLINK [[/D] | [/H] | [/J]] Link Target
 
        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

Examples

Link d:\myfile.txt (the file) to c:\something.txt (the link):

mklink c:\something.txt d:\myfile.txt

Make some crappy old program save its data to your fileserver directly by linking \\fileserver\data (target) to c:\program files\crappy-old-program\data (the directory).

mklink "c:\program files\crappy-old-program\data" \\fileserver\data /d
© GeekLabInfo Windows 7: Using symbolic links is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 1,50 out of 5)
Loading...

Use dsacls to gain access to active directory policies

I've locked myself out of group policies a couple of times. When this happens to you, you can gain access again running the following command:

dsacls.exe "CN={GUID},CN=Policies,CN=System,DC=local" /R "Authenticated users"

© GeekLabInfo Use dsacls to gain access to active directory policies is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

MS Paint: Insufficient memory

One of my users got an annoying message when starting MS Paint (mspaint.exe):

Onvoldoende geheugen of bronnen om de bewerking te voltooien. Sluit enkele programma's af en probeer het opnieuw.

Which means:

Insufficient memory to complete operation. Close some programs and try again

Other resources suggested that the file opened was too big or that we're doing something with a .tiff file. But he was just starting paint, no images involved at that point. The solution was to open regedit and remove the following key:
HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Paint
That reset all MS Paint settings and we could start paint again.

© GeekLabInfo MS Paint: Insufficient memory is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5,00 out of 5)
Loading...

Minimize Google Talk at startup

Google Talk has a function to automatically start on boot. However, it cannot minimalize automatically. To run Google Talk minimized by default, you'll need to use some external software.

CMDOW

I'm using a tool named cmdow to do the hiding for me. Cmdow is an extremely useful tool for showing, hiding, minimizing, resizing and closing windows. Unfortunately, some malware uses this functionality as well. Therefore, your virusscanner may tag cmdow as malware, but it actually isn't.

Scripting

Google Talk starts 'on boot'. Just a few seconds later we need to run the cmdow command. To do this, we create a .bat file in the Startup folder.

@echo off
rem The next line hides the batch file execution
cmdow @ /hid
rem The next line delays the batch exec for 4 seconds.
ping localhost
cmdow "Google Talk" /HID

© GeekLabInfo Minimize Google Talk at startup is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Printing from a CUPS server to Windows 7

A colleague of mine has some family issues that require him to be home more often. However, work continues. So he started working at home with a laptop. Nothing special about that. What is special, is that we're running a piece of software ("RR") that has old-style telnet-like terminals, which is sending it's print jobs straight to the printer.

His laptop has a direct VPN connection to the company network, but his printer doesn't.

Network info

The old software ("RR") is running on a pretty new RHEL 5.6 installation. It uses CUPS to queue and deliver print jobs. In my situation, the RR printer has zero printers configured, there's another Linux server that has all printers configured and broadcasts those printers over the network. But you could leave that print server out.

Problem

RR cannot reach the printer directly. But it can reach the laptop, which is running Windows 7 Professional. I searched for an IPP server that I could install on Windows, so that the printserver could use that to relay messages to the local printer, but I couldn't find any.

Solution

Windows 7 still has the option to install an lpd server. It's not installed by default, but it's very simple to install.

Windows setup:

  • In the Windows 7 Control Panel
  • Go to the "Programs and Features"
  • Click "Turn Windows Features on or off"
  • Turn on the LPD protocol.
  • Now go to the "printers" and share all printers you want to share.
  • Don't use long names and names with spaces, like "HP Laserjet 4200 Series", which are hard to setup on the client. Use something short like hplj4200.

Client setup:
Now you can setup the client to print to lpd://[ip-or-hostname-of-client]/[printername], for example lpd://10.10.10.17/hplj4200

If you can't get it to work, please check printer permissions and the firewall of the Windows 7 machine, which must have port 515 open.

© GeekLabInfo Printing from a CUPS server to Windows 7 is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3,00 out of 5)
Loading...

Find the Dell Service Tag Remotely

Windows with VNC/RDP

If you can login to the computer over VNC or RDP, you can use wmic to find the service tag:
start > run > cmd
On the command line, enter:
wmic bios get serialnumber

Windows without VNC/RDP

If you cannot login to the computer over VNC or RDP, you can still use wmic to find the service tag:
start > run > cmd
On the command line, enter:
wmic /node:computer-name-here bios get serialnumber
You may need to use /user:yourusername and /password:yourpassword to get access to the remote computer. Running wmic /? gives a pretty good manual on what wmic can do.

Other uses of wmic

wmic is a very useful tool for a lot of stuff. For instance wmic csproduct can tell you exactly what model the computer is and wmic nic list shows useful information about your network.

Linux

Under Linux, you can run dmidecode -s system-serial-number to get the serial number. This can be done locally or over ssh.

© GeekLabInfo Find the Dell Service Tag Remotely is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Run a batch file invisibly

Save this one line of text as c:\windows\quiet.vbs
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
To run a batch file invisibly, start it using the following command:
wscript.exe "C:\windows\quiet.vbs" "C:\path\file.bat"

© GeekLabInfo Run a batch file invisibly is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Error 1913: Setup cannot update file C:\windows\win.ini

Installing Microsoft Office 2010 using the preinstalled "out of the box" function, I got this error:
Error 1913: Setup cannot update file C:\windows\win.ini

Permissions were right. I could rename the file, so that means it was not in use by some other program... but apparently it was Trend Micro blocking the installation.

Using services.msc I disabled all Trend Micro stuff, finished the install and rebooted to get all services running as normal.

© GeekLabInfo Error 1913: Setup cannot update file C:\windows\win.ini is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Disable Windows 7 autorepair

Disable:
bcdedit /set {default} bootstatuspolicy ignoreallfailures
Re-enable:
bcdedit /set {default} bootstatuspolicy displayallfailures

© GeekLabInfo Disable Windows 7 autorepair is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...