You can do it by SHELL (waits for execution) or RUN (continues with Kixtart script)
eg:
shell 'wscript.exe yourscript.vbs [arguments]'
where [arguments] might be one of your KiX variables
http://www.kixtart.org/
Tuesday, 13 April 2010
Sunday, 7 March 2010
Run add printer wizard as another user
In a Windows 200X system (Windows 2000, Windows XP, Windows 2003), to start the printer wizard with another user like administration, go to the command line and execute this:
runas /U:administrator "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter"
runas /U:administrator "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter"
Friday, 5 March 2010
Proclarity: The selected page could not be opened because the cube could not be found
Here's a slightly dated but still fantastic document from Dawn Fink regarding cube could not be found errors. Check out the link near the bottom for a whitepaper on Kerberos Delegation and PAS.
SYMPTOMS:
Opening a book with the Standard Web Client displays a warning message. The message states, "The cube used by this page could not be found" [The selected page could not be opened because the cube could not be found.]. The message also states that the details of the condition have been recorded and sent to the web site administrator and that if immediate assistance is required, contact the administrator.
CAUSE:
The message fundamentally means that the ProClarity Analytic Server (PAS) could not contact Microsoft SQL Server Analysis Services (SSAS) successfully. There are many reasons why this might happen. This article will cover some common issues.
Configuration 1:
PAS is located on a separate machine from SSAS, and IIS authentication is set to "Windows Integrated," and Kerberos Delegation is not configured. This is also known as the "two-hop" problem.
Cause:
Because of intentional security restrictions, it is not possible in to have the OLAP server and PAS server on separate physical machines, use Integrated authentication and have OLAP security respected at the same time - unless you configure Kerberos Delegation.
Resolution:
There are a few possible solutions to this problem.
1. Set the IIS authentication to Basic only. This will allow PAS (IIS) to receive credentials and pass them on to the OLAP server. Note that when this is done IIS will display a warning about credentials being passed in clear text when using this mode - please use SSL to secure Basic traffic.
2. Move SSAS and PAS (IIS) to the same machine. This will eliminate one of the two hops in the two hop problem.
3. Do not use any security settings on SSAS by allowing the Anonymous IIS user access to the cube. This means that everyone will have access to all of the information on the server.
4. Configure your network to use the Kerberos Delegation. Please see the document below.
Configuration 2:
PAS and SSAS are located on the same machine OR they are located on separate machines AND IIS authentication is set to "Basic" and not "Windows Integrated".
Cause:
The user attempting to access SSAS does not have sufficient privileges to access the desired data.
Resolution:
Check the security roles on SSAS at both the cube level and the database level. Be sure the user has access to the data they are attempting to view.
Configuration 3:
PAS and SSAS are located on the same machine OR they are located on separate machines AND IIS authentication is set to "Basic" and not "Windows Integrated" (or you are leveraging the features of Kerberos Delegation). SSAS data has recently been migrated to another machine, the SSAS machine name has changed, one or more of the catalog names have been changed, or one or more of the cube names have been changed.
Resolution:
Please use ProClarity Professional and the Change Connection Information Wizard to verify you are pointing to the correct server, database (catalog), and cube.
http://blogs.technet.com/proclarity/attachment/3172290.ashx
SYMPTOMS:
Opening a book with the Standard Web Client displays a warning message. The message states, "The cube used by this page could not be found" [The selected page could not be opened because the cube could not be found.]. The message also states that the details of the condition have been recorded and sent to the web site administrator and that if immediate assistance is required, contact the administrator.
CAUSE:
The message fundamentally means that the ProClarity Analytic Server (PAS) could not contact Microsoft SQL Server Analysis Services (SSAS) successfully. There are many reasons why this might happen. This article will cover some common issues.
Configuration 1:
PAS is located on a separate machine from SSAS, and IIS authentication is set to "Windows Integrated," and Kerberos Delegation is not configured. This is also known as the "two-hop" problem.
Cause:
Because of intentional security restrictions, it is not possible in to have the OLAP server and PAS server on separate physical machines, use Integrated authentication and have OLAP security respected at the same time - unless you configure Kerberos Delegation.
Resolution:
There are a few possible solutions to this problem.
1. Set the IIS authentication to Basic only. This will allow PAS (IIS) to receive credentials and pass them on to the OLAP server. Note that when this is done IIS will display a warning about credentials being passed in clear text when using this mode - please use SSL to secure Basic traffic.
2. Move SSAS and PAS (IIS) to the same machine. This will eliminate one of the two hops in the two hop problem.
3. Do not use any security settings on SSAS by allowing the Anonymous IIS user access to the cube. This means that everyone will have access to all of the information on the server.
4. Configure your network to use the Kerberos Delegation. Please see the document below.
Configuration 2:
PAS and SSAS are located on the same machine OR they are located on separate machines AND IIS authentication is set to "Basic" and not "Windows Integrated".
Cause:
The user attempting to access SSAS does not have sufficient privileges to access the desired data.
Resolution:
Check the security roles on SSAS at both the cube level and the database level. Be sure the user has access to the data they are attempting to view.
Configuration 3:
PAS and SSAS are located on the same machine OR they are located on separate machines AND IIS authentication is set to "Basic" and not "Windows Integrated" (or you are leveraging the features of Kerberos Delegation). SSAS data has recently been migrated to another machine, the SSAS machine name has changed, one or more of the catalog names have been changed, or one or more of the cube names have been changed.
Resolution:
Please use ProClarity Professional and the Change Connection Information Wizard to verify you are pointing to the correct server, database (catalog), and cube.
http://blogs.technet.com/proclarity/attachment/3172290.ashx
Friday, 26 February 2010
How to write text on PDF files for free?
If you are looking to write text on PDF files or fill up forms, try:
http://www.pdfescape.com
It's a free online PDF editor, and will let you type on the file where-ever needed.
Here are its major features:
Free Online PDF Reader
Open PDF documents natively in your web browser
Rotate & zoom PDF pages to preferred viewing style
Select text and copy PDF content to your clipboard
Save, download, email, & print PDF documents
PDF thumbnail, bookmark, & link support
Free Online PDF Editor
Add text, shapes, whiteout & more to PDF files
Move, delete, & insert PDF pages
Create links to other PDF pages or web content
Change PDF information tags
Encrypt PDF contents using a password
Add & edit PDF annotations (sticky notes)
Free PDF Form Filler
Fill out PDF forms using existing form fields or use text tool
PDF text, checkbox, radio, list, and drop down fields supported
Essential PDF field calculation and formatting supported
Basic PDF field styling properties supported
Quickly tab from field to field
Free PDF Form Designer
Add new PDF form fields to any PDF file
Style PDF form fields (font, size, color, etc)
Modify existing PDF form fields
If you want more advanced features, the same company developed another application:
http://www.pdftypewriter.com
Price for this one is less than $30.
http://www.pdfescape.com
It's a free online PDF editor, and will let you type on the file where-ever needed.
Here are its major features:
Free Online PDF Reader
Open PDF documents natively in your web browser
Rotate & zoom PDF pages to preferred viewing style
Select text and copy PDF content to your clipboard
Save, download, email, & print PDF documents
PDF thumbnail, bookmark, & link support
Free Online PDF Editor
Add text, shapes, whiteout & more to PDF files
Move, delete, & insert PDF pages
Create links to other PDF pages or web content
Change PDF information tags
Encrypt PDF contents using a password
Add & edit PDF annotations (sticky notes)
Free PDF Form Filler
Fill out PDF forms using existing form fields or use text tool
PDF text, checkbox, radio, list, and drop down fields supported
Essential PDF field calculation and formatting supported
Basic PDF field styling properties supported
Quickly tab from field to field
Free PDF Form Designer
Add new PDF form fields to any PDF file
Style PDF form fields (font, size, color, etc)
Modify existing PDF form fields
If you want more advanced features, the same company developed another application:
http://www.pdftypewriter.com
Price for this one is less than $30.
Friday, 12 February 2010
Search Function not working in Sharepoint 3.0
I also noticed there were many warning messages in the event log, coming every 15 minutes:
'The start address cannot be crawled' Context: Application 'Search index file on the search server', Catalog 'Search' Details: Access is denied. Check that the Default Content Access Account has access to this content, or add a crawl rule to crawl this content. (0x80041205)
Verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled.
How to troubleshoot and solve it:
From a newsgroup post: "There are some particulars that are not documented very well when setting up your search settings.
The search engine will only crawl on a site that is the default zone.
If the default zone is secured (https), search will not return any results and you will see this error in the application log.
To fix this, create and extend the current web application with a new site. The default settings will suffice for everything except the zone. Change the “Zone” to Internet or Custom. This new site will be the site the search service uses to index. Bear in mind the site uses the same content as your public SharePoint site.
After creating the site, go to Operations > Alternate Access Mappings and change the “Alternate Access Mapping Collection to your main SharePoint site collection.
Then click “Edit Public URLs” and swap the URLs in the fields such that the Default zone is the new “unsecured” SharePoint site.
The secure site can be in any zone except the default zone.Now when the search indexer runs, it will use the default zone site (the new unsecured site) to crawl.
That’s it.
See the link to "www.kevincornwell.com - Windows SharePoint Services (WSS) 3.0 Search Setup Notes" for the original thread.
WSS Central Console --> Operations --> Alternate Address Mapping
In my case, I only reset the default Sharepoint - 80 site back to the servername.
Once this was configured, the crawling warnings went away.
Workaround also with these additional steps:
- Check accounts with permissions for search feature:
WSS Central Console --> Operations --> Services on Server --> Windows SharePoint Services Search Service Settings
- Select a content database
Central Admin -->Applicaton Management tab -->SharePoint Web Application Management heading --> Content databases
Ensure your web application is the one selectedSelect your content database nameUnder Search Server - select your server
OK
'The start address
Verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled. verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled.
How to troubleshoot and solve it:
From a newsgroup post: "There are some particulars that are not documented very well when setting up your search settings.
The search engine will only crawl on a site that is the default zone.
If the default zone is secured (https), search will not return any results and you will see this error in the application log.
To fix this, create and extend the current web application with a new site. The default settings will suffice for everything except the zone. Change the “Zone” to Internet or Custom. This new site will be the site the search service uses to index. Bear in mind the site uses the same content as your public SharePoint site.
After creating the site, go to Operations > Alternate Access Mappings and change the “Alternate Access Mapping Collection to your main SharePoint site collection.
Then click “Edit Public URLs” and swap the URLs in the fields such that the Default zone is the new “unsecured” SharePoint site.
The secure site can be in any zone except the default zone.Now when the search indexer runs, it will use the default zone site (the new unsecured site) to crawl.
That’s it.
See the link to "www.kevincornwell.com - Windows SharePoint Services (WSS) 3.0 Search Setup Notes" for the original thread.
WSS Central Console --> Operations --> Alternate Address Mapping
In my case, I only reset the default Sharepoint - 80 site back to the servername.
Once this was configured, the crawling warnings went away.
Workaround also with these additional steps:
- Check accounts with permissions for search feature:
WSS Central Console --> Operations --> Services on Server --> Windows SharePoint Services Search Service Settings
- Select a content database
Central Admin -->Applicaton Management tab -->SharePoint Web Application Management heading --> Content databases
Ensure your web application is the one selectedSelect your content database nameUnder Search Server - select your server
OK
Wednesday, 10 February 2010
SOLVED: unable to access file unspecified filename since it is locked
SOLVED: unable to access file since it is locked
This error message is so generic, and appeared to me at least in two different situations.
First time, trying to remove a snapshot of a VM, and second time, trying to power on a VM.
This is the second time now where I cannot power on the VDR virtual machine.
The message "Unable to access file since it is locked appears in the Recent tasks panel.

Since the filename is unspecified, it makes it hard to figure out what the issue is.
Why did it happen? Well, first I have to tell you that something went wrong in a backup process of one of my VMs, specifically the Virtual Center Server (in my case, this is a VM). It could be ANY VM, but in this case is this one. The last time, the same issue happened with a different VM, but anyway, the problem is the same.
Why did it happen? Well, first I have to tell you that something went wrong in a backup process of one of my VMs, specifically the Virtual Center Server (in my case, this is a VM). It could be ANY VM, but in this case is this one. The last time, the same issue happened with a different VM, but anyway, the problem is the same.

I figured out that the job failed, and It couldn't remove the snapshot. (VDR appliance creates a snapshot, and then copies the contents to the destination; after that, the snapshot is removed). But something went wrong, and the snapshot was not removed. It caused all future jobs also failed. I tried manually creating a snapshot for the failed VM, and then remove it, to force it to "Delete All" the unused snapshots, but the procedure failed, giving me the same error: "unable to access file since it is locked" ... mmmm, who is locking and which file ?????
I tried also moving the VM to another ESX in the cluster; restarted vmware management services; restarted the VM; restarted the ESX host itself, but no luck.
Ok, you got it, VDR is locking it .... but which file ???? I searched hours in google and Vmware KB, but nothing ... I opened a ticked with VMware. It took one day for them to call me back, just to acknowledge the ticket. It took another 3 days to have an email from them asking me for uploading the log files (I already did it at the time I opened the ticket !).It took another 3 days for them to call me, but I was busy and I couldn't work with them, after three more days, I called them again, but they told me they will call me back ... GRRR. I hate VMware support procedures and times.
Don't worry, I solved it by myself, and let me tell you how:
1) Shutdown the VDR appliance. It will free up the locked files in your VMs that were not sucessfuly backed up.
2) Create manually a snapshot in every VM with the problem, then "Delete all" snapshots will work !, you won't get that error message again.
3) "Try" to power on the VDR (VMware Data Recovery) appliance... Oh, no, the same message again! And now, I cannot power up the Virtual Machine !
4) I found the VDR "mounts" the hard disks of the VMs it is creating the backups, so, go to the VDR, and in commands "Edit settings".
By default, the VDR has only one hard disk, but mine shows three: those two extra hard disks corresponds to the Virtual Machine the backup failed!
Look at the hard disk description path for the first hard disk drive, and disk mode independent checkbox is not checked.

Look at the extra hard disks added to the VDR, see the hard disk description path (it corresponds to the VM that was in progress of backup). It also has the independent checkbox checked.


Select one by one the extra hard disks and click "Remove". Be very careful here, selecting just remove, and DO NOT dele files from disk.


Also, confirm that you selected the right hard disks ! If you make a mistake, just hit Cancel and do it again.
5) Verify that you have the single and right hard disk in place.

6) Power on the (VMware Data Recovery) appliance. Problem solved !

Friday, 15 January 2010
SQL 2005: Truncating Log Files and Recovering Space
A common issue for users of SQL Server databases is disk space and the size of the physical log file and database. While we’re not going to attempt to make “one size fits all” statement on database maintenance plans, we though it would be helpful to provide a few suggestions that will help you trim the size of your files when you are in a pinch.
Steps to truncating log files and shrinking your database:
1. Get the physical names of your database file (MDF) and log file (LDF):
Run the following system stored procedure:
use [yourdatabasename]
exec sp_helpfile
This command will return a variety of information, including the physical size (the “size” column) and the path and name of your database and log files (in the “filename” column).
Important:
Record the name of the file from the “filename” colunm, excluding the path and file extension (e.g. if filename contains “C:\sqldatabases\yourdatabase_data.mdf” you want to save the string “yourdatabase_data”)
2. Truncate the database and shrink the database
The following set of SQL will shrink your database and “truncate” the log file. File in the parmaters surrounded by […]. Note that you’ll need the two filename values from step 1, one for the data file and the other one for the log file, be very careful when typing in the file names:
USE [yourdatabasename]
GO
BACKUP LOG [yourdatabasename] WITH TRUNCATE_ONLY
GO
DBCC SHRINKFILE ([yourdatabaselogfilename], 1)
GO
DBCC SHRINKFILE ([yourdatabasedatafilename], 1)
GO
exec sp_helpfile
When complete, this script will output the same information as in step 1. Compare the new size with the old one.
If you get an error like:
"Cannot shrink log file because all logical log files are in use"
I solved doing the following:
1. open enterprise manager.
2. right click on the database you wanna shrink.
3. click on properties.
4. from the data properties go to options.
5. in the middle you will see recovery model. Make it "simple" then click on "ok" and try again.
Once done, it's recommended to take the parameter back to Recovery model = Full.
You can also setup the maximum log file size at this point, so you won't be facing the same problem again !
Steps to truncating log files and shrinking your database:
1. Get the physical names of your database file (MDF) and log file (LDF):
Run the following system stored procedure:
use [yourdatabasename]
exec sp_helpfile
This command will return a variety of information, including the physical size (the “size” column) and the path and name of your database and log files (in the “filename” column).
Important:
Record the name of the file from the “filename” colunm, excluding the path and file extension (e.g. if filename contains “C:\sqldatabases\yourdatabase_data.mdf” you want to save the string “yourdatabase_data”)
2. Truncate the database and shrink the database
The following set of SQL will shrink your database and “truncate” the log file. File in the parmaters surrounded by […]. Note that you’ll need the two filename values from step 1, one for the data file and the other one for the log file, be very careful when typing in the file names:
USE [yourdatabasename]
GO
BACKUP LOG [yourdatabasename] WITH TRUNCATE_ONLY
GO
DBCC SHRINKFILE ([yourdatabaselogfilename], 1)
GO
DBCC SHRINKFILE ([yourdatabasedatafilename], 1)
GO
exec sp_helpfile
When complete, this script will output the same information as in step 1. Compare the new size with the old one.
If you get an error like:
"Cannot shrink log file because all logical log files are in use"
I solved doing the following:
1. open enterprise manager.
2. right click on the database you wanna shrink.
3. click on properties.
4. from the data properties go to options.
5. in the middle you will see recovery model. Make it "simple" then click on "ok" and try again.
Once done, it's recommended to take the parameter back to Recovery model = Full.
You can also setup the maximum log file size at this point, so you won't be facing the same problem again !
Wednesday, 30 December 2009
List all Users and Groups in Domain
Using LDIFDE
From the support tools we can find LDIFDE.exe, which is a tool for bulk import and export of Active Directory Objects. You can use LDIFDE to import new user records into the directory, or export specific information on specific users into a text file. LDIFDE defaults to export mode (reading From the Directory). When you add the -i option it can be used to write changes into the Directory. Also, if you want to export and extract only specific details, such as the user name, title and login name for all the users in a specific OU (Organizational Unit), you can run the following command:
ldifde -f C:\ldif\ExportUsers.ldf –s SERVERNAME -d "OU=YourOUname,dc=YourDomainName,dc=com" -p subtree -r "(objectClass=User)" -l "cn,givenName,Title,SamAccountName"
From the support tools we can find LDIFDE.exe, which is a tool for bulk import and export of Active Directory Objects. You can use LDIFDE to import new user records into the directory, or export specific information on specific users into a text file. LDIFDE defaults to export mode (reading From the Directory). When you add the -i option it can be used to write changes into the Directory. Also, if you want to export and extract only specific details, such as the user name, title and login name for all the users in a specific OU (Organizational Unit), you can run the following command:
ldifde -f C:\ldif\ExportUsers.ldf –s SERVERNAME -d "OU=YourOUname,dc=YourDomainName,dc=com" -p subtree -r "(objectClass=User)" -l "cn,givenName,Title,SamAccountName"
Enabling Multiple Remote Desktop Sessions in Windows XP Professional and Media Center Edition 2005
If you have ever used a real remote computer system like Citrix, then you have probably been craving multiple Remote Desktop sessions since you first fired up Windows XP Professional and/or Media Center Edition. Here is a HACK (translated: USE AT YOUR OWN RISK), to enable multiple Remote Desktop sessions on your XP Pro or MCE 2005 box:
NOTE: You will have to have knowledge of the Windows operating system and more specifically the Windows Registry. If you have no experience with the registry, then I would recommend you find someone who does or leave these alone. I do not make any kind of warranty that this will work for you or your friends. This is provided for entertainment purposes only. Don’t call me if your computer stops working. Got it?
Print these directions so that you have them to work from.
Restart your computer in Safe Mode - Follow this link to learn how to restart Windows XP in Safe Mode
Turn off/disable Remote Desktop Connection (RDC) and Terminal Services
Right click My Computer
Select Properties
Click on the Remote tab at the top of the window
UNCHECK the box next to, “Allow users to connect remotely to this computer“
Click OK
Go to Start -> Control Panel -> Administrative Tools -> Services
Find Terminal Services in the list
Right click on Terminal Services and click Properties
In the Startup Type box, select Disabled
Click OK to close the window
Next you will replace the current version of the Terminal Services DLL (termsrv.dll) with an unrestricted version from a previous release of Terminal Services.
Here is a copy of the Terminal Services DLL - Save it to your Desktop or other suitable location
Using a file manager like Windows Explorer open C:\Windows\system32\dllcache
Rename the file termsrv.dll to termsrv_dll.bak or whatever you would like.
Copy the downloaded termsrv.dll file (the one you just downloaded from the web) to C:\Windows\system32\dllcache
Open the C:\Windows\system32 folder
Delete the file termsrv.dll in C:\Windows\system32
Now we can edit the Windows Registry to enable more than one RDP connection. Go to Start -> Run and type regedit - Hopefully you knew that already
Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Licensing Core
Add a DWORD Key named EnableConcurrentSessions and give it a value of 1
Close the Registry Editor window
Go to Start -> Run and type gpedit.msc to run the Group Policy Editor
Browse to Computer Configuration -> Administrative Templates -> Windows Components -> Terminal Services and double click Limit number of connections
Select the Enabled button and enter the number of connections you would like to enable….at least 2.
Restart Windows
Right click My Computer and select Properties.
Click on the Remote tab at the top of the window
CHECK the box next to, “Allow users to connect remotely to this computer“
Click OK
Go to Start -> Control Panel ->Administrative Tools -> Services. Select Terminal Services from the list and double click it or right-click -> Properties. Set the Startup Type to Manual.
Restart Windows/Computer
You should be good to go
NOTE: You will have to have knowledge of the Windows operating system and more specifically the Windows Registry. If you have no experience with the registry, then I would recommend you find someone who does or leave these alone. I do not make any kind of warranty that this will work for you or your friends. This is provided for entertainment purposes only. Don’t call me if your computer stops working. Got it?
Print these directions so that you have them to work from.
Restart your computer in Safe Mode - Follow this link to learn how to restart Windows XP in Safe Mode
Turn off/disable Remote Desktop Connection (RDC) and Terminal Services
Right click My Computer
Select Properties
Click on the Remote tab at the top of the window
UNCHECK the box next to, “Allow users to connect remotely to this computer“
Click OK
Go to Start -> Control Panel -> Administrative Tools -> Services
Find Terminal Services in the list
Right click on Terminal Services and click Properties
In the Startup Type box, select Disabled
Click OK to close the window
Next you will replace the current version of the Terminal Services DLL (termsrv.dll) with an unrestricted version from a previous release of Terminal Services.
Here is a copy of the Terminal Services DLL - Save it to your Desktop or other suitable location
Using a file manager like Windows Explorer open C:\Windows\system32\dllcache
Rename the file termsrv.dll to termsrv_dll.bak or whatever you would like.
Copy the downloaded termsrv.dll file (the one you just downloaded from the web) to C:\Windows\system32\dllcache
Open the C:\Windows\system32 folder
Delete the file termsrv.dll in C:\Windows\system32
Now we can edit the Windows Registry to enable more than one RDP connection. Go to Start -> Run and type regedit - Hopefully you knew that already
Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Licensing Core
Add a DWORD Key named EnableConcurrentSessions and give it a value of 1
Close the Registry Editor window
Go to Start -> Run and type gpedit.msc to run the Group Policy Editor
Browse to Computer Configuration -> Administrative Templates -> Windows Components -> Terminal Services and double click Limit number of connections
Select the Enabled button and enter the number of connections you would like to enable….at least 2.
Restart Windows
Right click My Computer and select Properties.
Click on the Remote tab at the top of the window
CHECK the box next to, “Allow users to connect remotely to this computer“
Click OK
Go to Start -> Control Panel ->Administrative Tools -> Services. Select Terminal Services from the list and double click it or right-click -> Properties. Set the Startup Type to Manual.
Restart Windows/Computer
You should be good to go
Friday, 11 December 2009
Bulk delete from Postfix queue
To delete a message in Postfix queue, I normally find out the message id first from “postqueue -p” (or simply “mailq”) command. Once the message id is known, I simply issue the following command to delete that particular message (assume the message id is BA4491827DE):
# postsuper -d BA4491827DE
If there is only one message to delete, I can live with that. However, when there’s a bunch of messages (e.g. from a particular domain) you need to delete from the queue, the above method simply too much of a hassle (well, unless you want to delete *everything*, which would be #postsuper -d ALL). Postfix does not have a function for doing that. Luckily, a search on Google yielded this Perl script that does exactly what I want, removing message(s) from queue based on my keyword. Here is the content of that Perl script called “delete-from-mailq”:
#!/usr/bin/perl
$REGEXP = shift || die “no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!”;
@data = qx;
for (@data) {
if (/^(\w+)(\*|\!)?\s/) {
$queue_id = $1;
}
if($queue_id) {
if (/$REGEXP/i) {
$Q{$queue_id} = 1;
$queue_id = “”;
}
}
}
open(POSTSUPER,”|postsuper -d -”) || die “couldn’t open postsuper” ;
foreach (keys %Q) {
print POSTSUPER “$_\n”;
};
close(POSTSUPER);
Save the above script to a file say “delete-queue” in your home directory, and make it excutable:
# chmod 755 delete-queue
Usage
Delete all queued messages from or to the domain “iamspammer.com”
./delete-queue iamspammer.com
Delete all queued messages to specific address “bogususer@mydomain.com”
./delete-queue bogususer@mydomain.com
Delete all queued messages that begin with the word “bush” in the e-mail address:
./delete-queue bush*\@whateverdomain.com
Delete all queued messages that contain the word “biz” in the e-mail address:
./delete-queue biz
That's it.
# postsuper -d BA4491827DE
If there is only one message to delete, I can live with that. However, when there’s a bunch of messages (e.g. from a particular domain) you need to delete from the queue, the above method simply too much of a hassle (well, unless you want to delete *everything*, which would be #postsuper -d ALL). Postfix does not have a function for doing that. Luckily, a search on Google yielded this Perl script that does exactly what I want, removing message(s) from queue based on my keyword. Here is the content of that Perl script called “delete-from-mailq”:
#!/usr/bin/perl
$REGEXP = shift || die “no email-adress given (regexp-style, e.g. bl.*\@yahoo.com)!”;
@data = qx;
for (@data) {
if (/^(\w+)(\*|\!)?\s/) {
$queue_id = $1;
}
if($queue_id) {
if (/$REGEXP/i) {
$Q{$queue_id} = 1;
$queue_id = “”;
}
}
}
open(POSTSUPER,”|postsuper -d -”) || die “couldn’t open postsuper” ;
foreach (keys %Q) {
print POSTSUPER “$_\n”;
};
close(POSTSUPER);
Save the above script to a file say “delete-queue” in your home directory, and make it excutable:
# chmod 755 delete-queue
Usage
Delete all queued messages from or to the domain “iamspammer.com”
./delete-queue iamspammer.com
Delete all queued messages to specific address “bogususer@mydomain.com”
./delete-queue bogususer@mydomain.com
Delete all queued messages that begin with the word “bush” in the e-mail address:
./delete-queue bush*\@whateverdomain.com
Delete all queued messages that contain the word “biz” in the e-mail address:
./delete-queue biz
That's it.
Subscribe to:
Posts (Atom)