Skip to content

Instantly share code, notes, and snippets.

View hclpandv's full-sized avatar
🎯
Focusing

Vikas Pandey hclpandv

🎯
Focusing
View GitHub Profile
@hclpandv
hclpandv / PsFunction.ps1
Last active January 31, 2017 13:34
PowerShell Function :
# Powershell Function to Replace string in word file
function Replace-Word(
[string]$Document,
[string]$FindText,
[string]$ReplaceText
)
{
$ReplaceAll = 2
$FindContinue = 1
@hclpandv
hclpandv / PsFunction_RationalizeDeptData.ps1
Created January 31, 2017 13:40
PowerShell Function : Rationalize-DeptData()
#PowerShell Function to Rationalize data conditionaly (by Department eg)
Function Rationalize-DeptData{
[CmdletBinding()]
[Parameter(Mandatory=$True,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True)]
Param([string]$DepartmentName, [String]$InputSheetPath, [string]$OutputSheetPath )
Import-Csv $InputSheetPath | Where-Object{$_.Department -eq $DepartmentName } | Sort-Object 'Application Name', 'Application Version' -Unique | Export-Csv $OutputSheetPath -NoTypeInformation -Append
@hclpandv
hclpandv / PsFunction_RationalizeConditional.ps1
Created January 31, 2017 13:46
PowerShell Function : Rationalize-Conditional()
#PowerShell function to rationalize application data based on certain conditions i.e. Hardware Drivers, Frewares etc
Function Rationalize-Conditional{
[CmdletBinding()]
[Parameter(Mandatory=$True,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True)]
Param([String]$InputSheetPath, [string]$OutputSheetPath )
#if(Test-Path $OutputSheetPath){Remove-Item -Force}
@hclpandv
hclpandv / PsFunction_MsiDbProps.ps1
Last active August 23, 2022 13:31
PowerShell Function : Get-MsiDatabaseProperties ()
#PowerShell Function to Get MSI Properties.
Function Get-MsiDatabaseProperties () {
<#
.SYNOPSIS This function retrieves properties from a Windows Installer MSI database.
.DESCRIPTION This function uses the WindowInstaller COM object to pull all values from the Property table from a MSI
.EXAMPLE Get-MsiDatabaseProperties 'MSI_PATH'
.PARAMETER FilePath The path to the MSI you'd like to query
#>
[CmdletBinding()]
@hclpandv
hclpandv / VbsFunction_DeleteOutDatedFiles.vbs
Last active January 31, 2017 15:06
VbScript Function : DeleteOutDatedFiles()
''**************************************************
'vbscript function to delete outdated files
''**************************************************
'Usage Below
'strFolder = "C:\Windows\ccmcache"
'Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objFolders = objFSO.GetFolder(strFolder)
'strLogfile = "c:\windows\temp\ChacheFilesDelete.log"
'DeleteOutDatedFiles objFolders
@hclpandv
hclpandv / PsFunction_TestMsiProductInstalled.ps1
Last active April 26, 2019 01:01
PowerShell Function : Test-MsiProductInstalled()
#Powershell function to check whether an MSI product code is installed or not
# Returns True/false
Function Test-MsiProductInstalled{
param([string]$ProductCode)
$MsiInstance = @"
using System.Runtime.InteropServices;
using System;
@hclpandv
hclpandv / VbsFunction_GetMSIProductCode.vbs
Created January 31, 2017 15:24
VbScript Function : GetMSIProductCode(msi)
Function GetMSIProductCode(msi)
''*************************************************
' Return the Product Code from a given msi(filePath)
'*************************************************
On Error Resume Next
GetMSIProductCode=""
If msi = "" Then Exit Function End If
Dim FS, TS, WI, DB, View, Rec
Set WI = CreateObject("WindowsInstaller.Installer")
@hclpandv
hclpandv / PsFunction_MsiDbTable.ps1
Last active February 1, 2017 02:30
PowerShell Function : Get-MsiDatabaseTable ()
#PowerShell Function to Get MSI Table. you can further export the table to csv
Function Get-MsiDatabaseTable () {
<#
.SYNOPSIS This function retrieves properties from a Windows Installer MSI database.
.DESCRIPTION This function uses the WindowInstaller COM object to pull all values from the Property table from a MSI
.EXAMPLE Get-MsiDatabaseProperties 'MSI_PATH'
.PARAMETER FilePath The path to the MSI you'd like to query
#>
[CmdletBinding()]
@hclpandv
hclpandv / MultiMsiInstallation.vbs
Created February 3, 2017 02:45
Script : Multiple MSI Installation
'On error resume next
'****************************************************************************************
' This is a template file used for Installtion of multiple msi's kept in various folder
' USAGE : Please Use the folderNames and 00_ , 01_ , 02_ ....and so on as prefix
' PLEASE UN-COMMENT Line#75 for actual Installtion. This is commented for a safety
' AUTHOR : Vikas Pandey
'****************************************************************************************
'*** SET DEBUG
Dim Debug : Debug = False
@hclpandv
hclpandv / ExcellCompare.hta
Created February 3, 2017 02:50
Script : HTA to Compare two Excell files
<!--Please Save This file as HTA. This is a HTA Script to compare two excel files-->
<html>
<head>
<title>Excel Comparison Tool</title>
<HTA:APPLICATION
APPLICATIONNAME="Package Promotion Tool"
ID="PackagePromotionTool"
VERSION="1.0"/>
</head>