Skip to content

Instantly share code, notes, and snippets.

View hclpandv's full-sized avatar
🎯
Focusing

Vikas Pandey hclpandv

🎯
Focusing
View GitHub Profile
#!/bin/bash --
#sqlite3 Needed. places.sqlite file needs to be copied in the folder
cd ./Linux
echo 'select url from moz_places;' | sqlite3 places.sqlite > B4Clean.txt
echo 'DELETE from moz_places where url Not Like "%Something%" AND url Not Like "%SomethingElse%";' | sqlite3 places.sqlite
@hclpandv
hclpandv / RemoteInstaller.ps1
Created August 11, 2017 07:59
Remote Instalation on multiple servers
$ScriptDir = Split-Path $MyInvocation.MyCommand.Path
$targetmachines = get-content $Scriptdir\serverlist.txt
# SourceInstallerFiles folder has to be placed with all Source Installer Binaries including the Installer.bat
foreach ($targetMachine in $targetmachines) {
Copy-item "$Scriptdir\SourceInstallerFiles" -Container -Destination "\\$targetMachine\C$" -recurse -force
$InstallString = "c:\SourceInstallerFiles\Installer.bat"
@hclpandv
hclpandv / Run-Threaded.ps1
Created May 19, 2017 05:39
Run-Threaded_ParrellelExecution
function Run-Threaded {
#.Synopsis
# This is a quick and open-ended script multi-threader searcher
#
#.Description
# This script will allow any general, external script to be multithreaded by providing a single
# argument to that script and opening it in a seperate thread. It works as a filter in the
# pipeline, or as a standalone script. It will read the argument either from the pipeline
# or from a filename provided. It will send the results of the child script down the pipeline,
#Place all your code in the MyCustomScript. Do Remember to Include Valid Params
$MyCustomScript = {
Param($ComputerName = "LocalHost")
Get-HotFix -ComputerName $ComputerName | Where-Object {$_.HotFixID -like "*KB4012*"}
}
$Computers = Get-Content "C:\temp\ServerList.txt"
# NEEDED FUNCTIONS AND SUBS
Function addUser2Group([string]$user, [string]$group, [switch]$domainUser)
{
$cname = gc env:computername
try
{
if($domainUser)
{
$domainName = gc env:userdomain
@hclpandv
hclpandv / RunParrallelJobs.ps1
Created March 23, 2017 02:31
PowerShell : Run Parrallel Jobs
$servers = @('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n')
foreach ($server in $servers) {
$running = @(Get-Job | Where-Object { $_.State -eq 'Running' })
if ($running.Count -ge 4) {
$running | Wait-Job -Any | Out-Null
}
Write-Host "Starting job for $server"
Start-Job {
@hclpandv
hclpandv / CheckSumCalc.ps1
Created February 16, 2017 06:18
Utility : CheckSum Calculator
<#
PowerShell Utility to Calculate CheckSum of any file
#>
#Generated Form Function
function GenerateForm {
#region Import the Assemblies
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
@hclpandv
hclpandv / LoadHive.ps1
Created February 16, 2017 06:05
Script : Loading an HKCU Hive to a target User
<#
Loading an HKCU Hive to a target User
Script Usage: written for adding HKCU Keys while ruuning the script through system account
#>
cls
Function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
@hclpandv
hclpandv / BginfoWrapper.ps1
Created February 16, 2017 05:50
Script : Bginfo Wrapper Script
cls
#First Thing First: Lets come to Script Directory
Function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
cd (Get-ScriptDirectory)
@hclpandv
hclpandv / Blackboard.StorableColorTheme.ps1xml
Last active February 16, 2017 05:51
PowerShell ISE Themes
<?xml version="1.0" encoding="utf-16"?>
<StorableColorTheme xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Keys>
<string>ErrorForegroundColor</string>
<string>ErrorBackgroundColor</string>
<string>WarningForegroundColor</string>
<string>WarningBackgroundColor</string>
<string>VerboseForegroundColor</string>
<string>VerboseBackgroundColor</string>
<string>DebugForegroundColor</string>