Archive for the ‘Programming and Scripting’ Category

How to delete TCP IP printers?

So you want to know how to create a script to delete a TCP/IP printer from a computer?  You are in luck.  There are several ways to do this, but the easiest way to accomplish this is by using the ‘WMIC’ command.  Once you have the command created, you can save it as a batch [...]

Leave a Comment

Assign Printers Based on Group Membership

Today, I was giving the task of assigning printers to a set of users based on their group membership.  By searching online, I found this script from the Microsoft site which does exactly what I am tasked to do.
Link
VN:F [1.0.8_357]please wait…Rating: 0.0/10 (0 votes cast)

Leave a Comment

How to rename mapped shares remotely?

Today, I came across a task of renaming all of our users personal folders to another server, and we have 1000 users.  This will be a pain in the butt if I have to go to every station to manually remap the new share for them.
To avoid going to every station, I have searched online [...]

Leave a Comment

Linux: How to search and print command output?

Well today, I was trying to do a simple test with Ubuntu. .. that is trying to print the output of the ‘ps -aux‘ command.  It wasn’t that bad.  The way to do this is to pipe it into the ‘LPR’ that is your printer.
e.g. ps -aux | lpr
This will send the output to your [...]

Leave a Comment

How to display password expiry date for all users in Active Directory

Here is a script that I found on the web that will list out all users with password expiry date and will email the user with instruction on how to change their password.
Option Explicit
Dim objCommand, objConnection, strBase
Dim strFilter, strAttributes, strPasswordChangeDate, intPassAge
Dim lngTZBias, objPwdLastSet, strEmailAddress
Dim objShell, lngBiasKey, k, PasswordExpiry, strRootDomain
Dim strQuery, objRecordset, strName, strCN
Dim objEmail, objFSO, [...]

Leave a Comment

Subtraction in Excel?

How to subtract in Excel?
You will need to enter the following formula into the function area.
e.g. Type in ‘=A1 – B1′

Leave a Comment

Script to list free disk space on a computer?

Script to list free disk space on a computer?
If you are running a Microsoft OS, then you can use this script from the Microsoft site to list the FreeSpace.
CODE:
Const HARD_DISK = 3
strComputer = “.”
Set objWMIService = GetObject(”winmgmts:” _
& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2″)
Set colDisks = objWMIService.ExecQuery _
(”Select [...]

Leave a Comment

How to auto submit a form?

How to auto submit a form?
To auto submit a form, you can place the submit funtion in the onLoad parameter in the <body> tag.
e.g.   <body onload=”$(’formname’).submit()”>
VN:F [1.0.8_357]please wait…Rating: 0.0/10 (0 votes cast)

Leave a Comment

How to prompt for variable in a batch file?

For those that wanted to prompt users for information on their batch script, here is how you can do this.
@echo off
echo “Enter your name”
set /p Name=
echo “Enter your password”
set /p Password=
echo %Name% %Password%
VN:F [1.0.8_357]please wait…Rating: 10.0/10 (1 vote cast)

Leave a Comment

How to remove period from a string?

How to remove period from a string?
for example: www.domainname.com
It needs to be ‘wwwdomainnamecom’
Solution:
$Newdomainname = ereg_replace(’.’, ”, $domainname);
or
$Newdomainname = str_replace(’.’, ”, $domainname);
VN:F [1.0.8_357]please wait…Rating: 7.0/10 (1 vote cast)

Leave a Comment