Posts

Showing posts from 2012

Microsoft Office 2003 Registration Info After Uninstall

Recently I had to uninstall Microsoft Office 2003 from a computer and then install Microsoft Office 2007. The were no errors on both processes but when I scanned the computer with Spiceworks, it appeared  to have Office 2003 installed as well as 2007. That is because the registration info is not removed when the product is unistalled.

In order to remove that info, you have to delete the following key and it's subkeys:
HKLM\Software\Microsoft\Office\11.0\Registration

You should backup your registry before making any changes, or at least the keys you 're about to delete.

Microsoft Exchange 2007 and Email Forwarding

A very common scenario is the one where you are using Microsoft Exchange Server 2007 as your communication system and you have users that want their messages to be forwarded to another address.

For example, your domain is foo.com and you have a user that already has an email account at bar.com. If you do not want to create a mailbox on your exchange you can simply create a mail contact and on that mail contact you have to set the address at bar.com as Reply and External and add the address that you want the contact to have on your organization.

MPI.NET Installation and Usage

MPI.NET is a great MPI implementation for MPI and C#.

You can find installation instructions on the mail page but to summarize the procedure all you have to do is: Install Windows Computer ClusterInstall MPI.NET runtime or SDK on all computers You can then test the MPI installation by running pingpong.exe just like it's described in the tutorial.
In order to start an application on another computer you must start the smpd service by starting smpd.exe on  microsoft compute cluster bin folder with -d as argument.

You also have to create rules that allow mpi traffic on your firewall for mpiexec and your application.

Microsoft Exchange 2007 Agent Logs

Unfortunately, the logging for the rejected or deleted messages in Exchange Server 2007 is a bit poor.

There is a set of commands that may help examining the log:
Display the log for the specific period:
Get-AgentLog -StartDate “4/16/2007″ -EndDate “4/17/2007″
Get-AgentLog -StartDate “4/17/2007 8:00 AM” -EndDate “4/17/2007 2:00 PM”Filtering in order to show messages to a particular recipient:
Get-AgentLog -StartDate “4/16/2007″ -EndDate “4/17/2007″ | where {$_.recipients -like “foo@yourdomain.com”}To search for messages from a particular sender: Get-AgentLog -StartDate “4/16/2007″ -EndDate “4/17/2007″ | where {$_.P1FromAddress -like “aqe@easymoney2u.com” -or $_.P2FromAddresses -like “aqe@easymoney2u.com”} There are more commands, that can help you filter the log for the agent or the host IP address and other stuff. Many thanks to Bharat Suneja for this article.

Autodesk TrueView 2012 Aunattended Setup

I was trying to deploy Autodesk Trueview 2012 but I could not find a MSI package in order to use it with GPO.

If you download the installation file and extract it's contents you can use the following command in order to perform a silent installation: setup.exe /Q /W /I setup.ini

Further setup options can be configured on setup.ini file.

This command in combination with psexec tools can help you deploy the package.

Live Mesh functionality with Skydrive

I myself am one of the people who used Live Mesh in order to sync my documents with skydrive.

But with Mesh deprecated I can no longer select a folder an have it sync with skydrive, I have to move my files in the Skydrive folder.

One solution to the problem is to create junctions using junction.

Lets say you have a directory called "testdir" on your desktop folder. You can use junction to make a junction point inside your skydrive folder that points to the folder "testdir". In order to do that you can use: junction Skydrive\dir desktop\testdir.

If you want to delete the junction point just enter: junction -d skydrive\dir

The only problem is that the directory cannot be on the network...

Be very careful with junction point because the changes in the junction point affect the original folder too.

Create ISO files using Powershell

You can use the following function in order to create .ISO files using Windows Powershell:


function New-IsoFile 

  <# 
   .Synopsis 
    Creates a new .iso file 
   .Description 
    The New-IsoFile cmdlet creates a new .iso file containing content from chosen folders 
   .Example 
    New-IsoFile "c:\tools","c:Downloads\utils" 
    Description 
    ----------- 
    This command creates a .iso file in $env:temp folder (default location) that contains c:\tools and c:\downloads\utils folders. The folders themselves are added in the root of the .iso image. 
   .Example 
    dir c:\WinPE | New-IsoFile -Path c:\temp\WinPE.iso -BootFile etfsboot.com -Media DVDPLUSR -Title "WinPE" 
    Description 
    ----------- 
    This command creates a bootable .iso file containing the content from c:\WinPE folder, but the folder itself isn't included. Boot file etfsboot.com can be found in Windows AIK. Refer to IMAPI_MEDIA_PHYSICAL_TYPE enumeration for possible media types: 

   …

Microsoft Exchange 2007 Permantly Delete Mailbox

When you delete a mailbox in Exchange Server 2007 using the Exchange Management Console or the remove-mailbox command in Exchange Management Shell the mailbox remains on the server for a specified period of time.

You can get all the disconected mailboxes by using the following command on Exchange Management Shell:

Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

This command displays the name of the user and the GUID of the mailbox so you can use it in order to delete it.

To remove a single mailbox you can use the this command:
Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false

You can delete all the disconected mailboxes with this command:
Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName, MailboxGuid, Database | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }

Be very carefull when it com…

Harvest email addresses using Backtrack and msfconsole

Hello all,

Most of you probably already know what i am about to explain here. But bear with me

Tools you will need :
1) Backtrack 5 ( Contains Msfconsole by default)

Instructions :
1) Lets begin by opening your shell command on Backtrack 5.
2) Next type the following commands shown below :
root@root:~# msfconsole
NOTICE: CREATE TABLE will create implicit sequence “hosts_id_seq” for serial column “hosts.id”
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index “hosts_pkey” for table “hosts”
NOTICE: CREATE TABLE will create implicit sequence “clients_id_seq” for serial column “clients.id”
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index “clients_pkey” for table “clients”
* Allow Msfconsole to fully load till the screen below appears.
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMM MMMMMMMMMM
MMMN$ vMMMM
MMMNl MMMMM MMMMM JMMMM
MMMNl MMMMMMMN NMMMMMMM JMMMM
MMMNl MMMMMMMMMNmmmNMMMMMMMMM JMMMM
MMMNI MMMMMMMMMMMMMMMMMMMMMMM jMMMM
MMMNI MMMMMMMMMMMMMMMMMMMMMMM jMMMM
MMMNI…

Case insensitive String.Contains for C#

So, you want to use the String.contains method but you want it to be case insensitive.
You can use the following test instead:

string s = "MYSTRING";
if( s.IndexOf("string", 0, StringComparison.CurrentCultureIgnoreCase) != -1 )
{
    // String contains "string"
}
else
{
   // String does not contain "string"
}

We use "-1" because "0" can be an index

Username to SID Assosiation

To find the sid of a user using the username and vice versa use the following command:

wmic useraccount get name,sid

PowerShell Ping Function

You can use the following boolean function to ping a host using powershell:


function Ping-Host {param([string]$HostName,
[int32]$Requests = 3)

for ($i = 1; $i -le $Requests; $i++) {
$Result = Get-WmiObject -Class Win32_PingStatus -ComputerName . -Filter "Address='$HostName'"
Start-Sleep -Seconds 1
if ($Result.StatusCode -ne 0) {return $FALSE}
}
return $TRUE
}

Adobe Flash Auto Update disable script

Use the following vbs script in order to disable the auto update feature of adobe flash player.


' Adobe Flash Auto Update Manage
' Use this script in order to manage the auto update for adobe flash
' Author: Christos Polydorou, xristos.polydoroy@gmail.com

' This routine calculates the path to the flash installation directory
Function GetSystemPath()
Set wshShell = CreateObject( "WScript.Shell" )
GetSystemPath = wshShell.ExpandEnvironmentStrings( "%systemroot%" ) + "\system32\Macromed\Flash\mms.cfg"
End Function

' This routine saves data to a UTF-8 file
Sub Save2File (sText, sFile)
    Dim oStream
    Set oStream = CreateObject("ADODB.Stream")
    With oStream
        .Open
        .CharSet = "utf-8"
        .WriteText sText
        .SaveToFile sFile, 2
    End With
    Set oStream = Nothing
End Sub

' This routine enable the auto updater
Sub Enable
Save2File "AutoUpdateDisable=0", GetSystemPath()
End Sub

' This routine dis…

Adobe Reader X 10 GPO

Use the following file to change the settings of Adobe Reader X. The computer settings are in red, the user in green.


CLASS MACHINE
CATEGORY "Adobe Reader 10" 
CATEGORY "Preferences"
  CATEGORY "Updater" 
   POLICY "Do not download or install updates automatically" 
   KEYNAME "Software\Wow6432Node\Adobe\Adobe ARM\1.0\ARM" 
   EXPLAIN !!ExplainUpdaterDisable 
   VALUENAME "iCheckReader" 
   VALUEON NUMERIC 0 
   VALUEOFF NUMERIC 2 
   END POLICY 
  END CATEGORY 
   END CATEGORY
END CATEGORY

CLASS USER 
CATEGORY "Adobe Reader 10" 
CATEGORY "Adobe Reader 10.x MUI"
   POLICY "Use the same language as the Operating System"
   KEYNAME "Software\Adobe\Acrobat Reader\10.0\Language\UseMUI"
   EXPLAIN "With this policy enabled, the Adobe Reader MUI will display in the same language as the Microsoft Windows language.  
   For Microsoft Windows with MUI, the Adobe Reader MUI will display in the same language as …

Disable Adobe Updater using GPO

You can use the following ADM file to disable Adobe updater. Just copy the colored text into an ADM file and add it to your policy object.


CLASS MACHINE CATEGORY !!Reader         POLICY !!Checkforupdatesatstart
 KEYNAME "Software\Adobe\Acrobat Reader\9.0\AVGeneral"
            EXPLAIN !!Checkforupdatesatstart_Help
                VALUENAME "bCheckForUpdatesAtStartup"
                    VALUEON NUMERIC 1
                    VALUEOFF NUMERIC 0
        END POLICY         POLICY !!DonotdisplayEULA
            KEYNAME "Software\Adobe\Acrobat Reader\9.0\AdobeViewer"
            EXPLAIN !!DonotdisplayEULA_Help
                VALUENAME "EULA"
                    VALUEON NUMERIC 1
                    VALUEOFF NUMERIC 0
        END POLICY         POLICY !!EnableAdobeUpdater
            KEYNAME "SOFTWARE\Policies\Adobe\Acrobat Reader\9.0\FeatureLockdown"
            EXPLAIN !!EnableAdobeUpdater_Help
                VALUENAME "bUpdater"
                  …

Disable Java Updater using GPO

You can use the following ADM file to disable Java updater. Just copy the colored text into an ADM file and add it to your policy object.


CLASS MACHINE CATEGORY !!Java         POLICY !!Checkforupdatesatstart
 KEYNAME "SOFTWARE\JavaSoft\Java Update\Policy"
            EXPLAIN !!Checkforupdatesatstart_Help
                VALUENAME "EnableAutoUpdateCheck"
                    VALUEON NUMERIC 1
                    VALUEOFF NUMERIC 0
        END POLICY         POLICY !!EnableJavaUpdater
            KEYNAME "SOFTWARE\JavaSoft\Java Update\Policy"
            EXPLAIN !!EnableJavaUpdater_Help
                VALUENAME "EnableJavaUpdate"
                    VALUEON NUMERIC 1
                    VALUEOFF NUMERIC 0
        END POLICY END CATEGORY [strings]
Java="Ross' Java Template"
EnableJavaUpdater="Enable Java Updater"
EnableJavaUpdater_Help="When set to Enabled, Java Updater can run and the 'Check for updates' option appears on the Help…

Get GUIDs of installed software

You can get the GUIDs of installed software using the following Visual Basic script:


Set oWMIroot = GetObject("WinMgmts:root/cimv2")

Set oWMIColl = oWMIroot.ExecQuery("Select IdentifyingNumber, Name  FROM Win32_Product")

For Each oWMIval In oWMIColl
    WScript.Echo oWMIval.Name & " = " & oWMIval.IdentifyingNumber
Next

SCE 2007 SP1 Client Software Unistall

In order to uninstall the client software of System Center Essentials 2007 SP1 you can use the following commands:

msiexec.exe /x {E7600A9C-6782-4221-984E-AB89C780DC2D} /qn for the agent
msiexec.exe /x {11447AB1-2B37-49D3-9963-2ACDFA06E04B} /qn for the configuration helper

Windows Time Configuration

In order to configure the windows time service use the following commands:
w32tm /config /manualpeerlist:PEERS /syncfromflags:manual /update (Peers is a list of time servers, you may find many of them at http://www.pool.ntp.org/)net stop w32timenet start w32timew32tm /resync for domain members use /syncfromflags:domhier at step 1.
To check the time difference between the computer and the time server use the command:
w32tm /stripchart /computer:timeserver /samples:5 /dataonly

Killing a windows service that seems to hang on "Stopping"

It sometimes happens (and it's not a good sign most of the time): you'd like to stop a Windows Service, and when you issue the stop command through the SCM (Service Control Manager) or by using the ServiceProcess classes in the .NET Framework or by other means (net stop, Win32 API), the service remains in the state of "stopping" and never reaches the stopped phase. It's pretty simple to simulate this behavior by creating a Windows Service in C# (or any .NET language whatsoever) and adding an infinite loop in the Stop method. The only way to stop the service is by killing the process then. However, sometimes it's not clear what the process name or ID is (e.g. when you're running a service hosting application that can cope with multiple instances such as SQL Server Notification Services). The way to do it is as follows:
1.Go to the command-prompt and query the service (e.g. the SMTP service) by using sc:



2.    sc queryex SMTPSvc This will give you the followin…

ISA Server 2006 L2TP/IPSec certificate

Consider the following scenario:

You've set up L2TP security for VPN access on ISA server and you've also published a site using HTTPS.
For both services you use a certificate for the domain let's say server.company.com.

Now you want to publish another site, let's say server2.company.com using HTTPS. You import the new certificate, create the publishing rule and everything is OK but the VPN...

This is because the ISA server might select the new certificate to use for VPN connections.

In that case you have to create a custom certificate request using the correct address and Server Authentication and IP sercurity IKE intermediate key usage and install the certificate.