Finding msp
------------------------------------------------------------------------This is Praveen. I have completed my graduation in the stream of Bachelor of Technology at JNTU University in 2009. I have completed my Intermediate education at Shri Prathiba Junior College.
I have worked as a MS SQL DBA in Wipro. Later, I worked as a MS SQL DBA at Ensono Technologies.
My hobbies are listening music, watching television, and playing caroms.
My strengths are self motivated and being dedicated.
I can present my skill and abilities as much as possible for the growth of the organisation.-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if( WScript.Arguments.Length < 1 )
{
WScript.Echo( "Usage: RepairSP1Source.js \"<path to extracted SP1 files>\"" );
WScript.Quit( 1 );
}
var filesystem = new ActiveXObject( "Scripting.FileSystemObject" );
var newSource = WScript.Arguments( 0 );
if( !filesystem.FolderExists( newSource ) )
{
WScript.Echo( "The path to the extracted SP1 package does not exist. Please correct the path and run the tool again." );
WScript.Quit( 1 );
}
var installer = WScript.CreateObject( "WindowsInstaller.Installer" );
// Look for MSPs at the extracted location
EnumerateMSPs( newSource );
function EnumerateMSPs( extractedSp1PatchPath )
{
var folder = filesystem.GetFolder( extractedSp1PatchPath );
var fileEnum = new Enumerator( folder.Files );
for( ; !fileEnum.atEnd(); fileEnum.moveNext() )
{
var nextFile = fileEnum.item();
if( filesystem.GetExtensionName( nextFile.Name ) == "msp" )
{
WScript.Echo( "Found patch located at: " + nextFile.Path );
var extractedSp1PatchSummaryInfo = installer.SummaryInformation( nextFile.Path );
// Retrieve the PatchCode from the SummaryInformation
var extractedSp1PatchCode = new String( extractedSp1PatchSummaryInfo.Property( 9 ) ).substring( 0, 38 );
// Look to see if we need to repair the cached MSP for this Patch
RepairCachedMSP( extractedSp1PatchCode, nextFile.Path );
WScript.Echo();
}
}
// Now look in subfolders for MSPs
var folderEnum = new Enumerator( folder.SubFolders );
for( ; !folderEnum.atEnd(); folderEnum.moveNext() )
{
var nextFolder = folderEnum.item();
EnumerateMSPs( nextFolder.Path );
}
}
function RepairCachedMSP( extractedSp1PatchCode, extractedSp1PatchPath )
{
var sp1Patch = null;
var cachedSp1PatchFileName = null;
WScript.Echo( "Attempting to repair the local cache for PatchCode \"" + extractedSp1PatchCode + "\"" );
// Enumerate all products installed on the machine to see if any have been patched by
// this MSP
var products = installer.ProductsEx( "", "", 4 );
// Look for the first product that is patched with this MSP.
for( var x = 0; (sp1Patch == null) && (x < products.Count); x++ )
{
var nextProduct = products.Item( x );
var nextProductPatches = installer.PatchesEx( nextProduct.ProductCode, "", 4, 1 );
for( var y = 0; (sp1Patch == null) && (y < nextProductPatches.Count); y++ )
{
var nextProductPatch = nextProductPatches.Item( y );
var nextPatchURL = nextProductPatch.PatchProperty( "MoreInfoURL" );
var nextPatchURLString = new String( nextPatchURL );
// See if this patch is SP1 and if it matches the PatchCode of what the user
// extracted to the hard drive.
if ( extractedSp1PatchCode == nextProductPatch.PatchCode )
{
cachedSp1PatchFileName = nextProductPatch.PatchProperty( "LocalPackage" );
// Only re-cache if the MSP is missing
if( !filesystem.FileExists( cachedSp1PatchFileName ) )
{
sp1Patch = nextProductPatch;
}
}
}
}
if( !cachedSp1PatchFileName )
{
WScript.Echo( "No action can be taken as the patch has not been applied on the local machine." );
}
else
{
if( sp1Patch == null )
{
WScript.Echo( "No action will be taken since the provided SP1 patch appears to exist locally." );
}
else
{
var extractedSp1Patch = filesystem.GetFile( extractedSp1PatchPath );
WScript.Echo( "Re-caching patch for the product code \"" + sp1Patch.ProductCode
+ "\" and patch \"" + sp1Patch.PatchCode + "\" to \"" + cachedSp1PatchFileName + "\"" );
extractedSp1Patch.Copy( cachedSp1PatchFileName );
var updatedSp1Patch = filesystem.GetFile( cachedSp1PatchFileName );
var currentAttributes = updatedSp1Patch.Attributes;
// If the file isn't read-only mark it as such.
if( ( currentAttributes & 1 ) == 0 )
{
updatedSp1Patch.Attributes = (currentAttributes | 1 );
}
}
}
}
--------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------This is Praveen. I have completed my graduation in the stream of Bachelor of Technology at JNTU University in 2009. I have completed my Intermediate education at Shri Prathiba Junior College.
I have worked as a MS SQL DBA in Wipro. Later, I worked as a MS SQL DBA at Ensono Technologies.
My hobbies are listening music, watching television, and playing caroms.
My strengths are self motivated and being dedicated.
I can present my skill and abilities as much as possible for the growth of the organisation.-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if( WScript.Arguments.Length < 1 )
{
WScript.Echo( "Usage: RepairSP1Source.js \"<path to extracted SP1 files>\"" );
WScript.Quit( 1 );
}
var filesystem = new ActiveXObject( "Scripting.FileSystemObject" );
var newSource = WScript.Arguments( 0 );
if( !filesystem.FolderExists( newSource ) )
{
WScript.Echo( "The path to the extracted SP1 package does not exist. Please correct the path and run the tool again." );
WScript.Quit( 1 );
}
var installer = WScript.CreateObject( "WindowsInstaller.Installer" );
// Look for MSPs at the extracted location
EnumerateMSPs( newSource );
function EnumerateMSPs( extractedSp1PatchPath )
{
var folder = filesystem.GetFolder( extractedSp1PatchPath );
var fileEnum = new Enumerator( folder.Files );
for( ; !fileEnum.atEnd(); fileEnum.moveNext() )
{
var nextFile = fileEnum.item();
if( filesystem.GetExtensionName( nextFile.Name ) == "msp" )
{
WScript.Echo( "Found patch located at: " + nextFile.Path );
var extractedSp1PatchSummaryInfo = installer.SummaryInformation( nextFile.Path );
// Retrieve the PatchCode from the SummaryInformation
var extractedSp1PatchCode = new String( extractedSp1PatchSummaryInfo.Property( 9 ) ).substring( 0, 38 );
// Look to see if we need to repair the cached MSP for this Patch
RepairCachedMSP( extractedSp1PatchCode, nextFile.Path );
WScript.Echo();
}
}
// Now look in subfolders for MSPs
var folderEnum = new Enumerator( folder.SubFolders );
for( ; !folderEnum.atEnd(); folderEnum.moveNext() )
{
var nextFolder = folderEnum.item();
EnumerateMSPs( nextFolder.Path );
}
}
function RepairCachedMSP( extractedSp1PatchCode, extractedSp1PatchPath )
{
var sp1Patch = null;
var cachedSp1PatchFileName = null;
WScript.Echo( "Attempting to repair the local cache for PatchCode \"" + extractedSp1PatchCode + "\"" );
// Enumerate all products installed on the machine to see if any have been patched by
// this MSP
var products = installer.ProductsEx( "", "", 4 );
// Look for the first product that is patched with this MSP.
for( var x = 0; (sp1Patch == null) && (x < products.Count); x++ )
{
var nextProduct = products.Item( x );
var nextProductPatches = installer.PatchesEx( nextProduct.ProductCode, "", 4, 1 );
for( var y = 0; (sp1Patch == null) && (y < nextProductPatches.Count); y++ )
{
var nextProductPatch = nextProductPatches.Item( y );
var nextPatchURL = nextProductPatch.PatchProperty( "MoreInfoURL" );
var nextPatchURLString = new String( nextPatchURL );
// See if this patch is SP1 and if it matches the PatchCode of what the user
// extracted to the hard drive.
if ( extractedSp1PatchCode == nextProductPatch.PatchCode )
{
cachedSp1PatchFileName = nextProductPatch.PatchProperty( "LocalPackage" );
// Only re-cache if the MSP is missing
if( !filesystem.FileExists( cachedSp1PatchFileName ) )
{
sp1Patch = nextProductPatch;
}
}
}
}
if( !cachedSp1PatchFileName )
{
WScript.Echo( "No action can be taken as the patch has not been applied on the local machine." );
}
else
{
if( sp1Patch == null )
{
WScript.Echo( "No action will be taken since the provided SP1 patch appears to exist locally." );
}
else
{
var extractedSp1Patch = filesystem.GetFile( extractedSp1PatchPath );
WScript.Echo( "Re-caching patch for the product code \"" + sp1Patch.ProductCode
+ "\" and patch \"" + sp1Patch.PatchCode + "\" to \"" + cachedSp1PatchFileName + "\"" );
extractedSp1Patch.Copy( cachedSp1PatchFileName );
var updatedSp1Patch = filesystem.GetFile( cachedSp1PatchFileName );
var currentAttributes = updatedSp1Patch.Attributes;
// If the file isn't read-only mark it as such.
if( ( currentAttributes & 1 ) == 0 )
{
updatedSp1Patch.Attributes = (currentAttributes | 1 );
}
}
}
}
--------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment