Skip to content

Instantly share code, notes, and snippets.

/Verifier.ps1 Secret

Created January 30, 2017 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d4fe7212b5c624bf3b77c35d7f9b48bf to your computer and use it in GitHub Desktop.
Save anonymous/d4fe7212b5c624bf3b77c35d7f9b48bf to your computer and use it in GitHub Desktop.
INI builder
Get-Variable -Exclude PWD,*Preference | Remove-Variable -EA 0
function Start-VPN {
if (gwmi Win32_NetworkAdapterConfiguration | Where-Object {($_.Description -ilike "*Cisco Systems*") -and ($_.IpEnabled -eq $False)}){
if ((Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq '64-bit'){
Start-Process 'C:\Program Files (x86)\Cisco Systems\VPN Client\vpnclient.exe' "connect GroupName user UserName pwd pAsS" -EA 0}
Else {Start-Process 'C:\Program Files\Cisco Systems\VPN Client\vpnclient.exe' "connect GroupName user UserName pwd pAsS" -EA 0}
}
}
function Set-INI {
$xms = "-Xms512M"
$xmx = "-Xmx768M"
$Drivlet = [System.IO.DriveInfo]::GetDrives() |
Where-Object{
$_.DriveType -ne "Network" -and $_.DriveType -ne "CDRom" -and $_.DriveType -ne "DVDRom" -and $_.Name -ne "E:\"
}
$redac = $Drivelet -replace ':\\',''
$Projects = Get-PSDrive -Name $redac |
ForEach-Object{Set-Location $_.Root;
Get-ChildItem -Recurse -Depth 1 |
Where-Object {$_.PSIsContainer} |
Where-Object {$_.Name -match "^[0-9]{5,6}[a-zA-Z]?$"} |
Sort-Object -Unique |
Foreach-Object{
$_.FullName
}
}
$TPS = $Projects |
Select-String '[0-9]{5,6}[a-zA-Z]?$' -AllMatches |
Sort-Object -Unique |
ForEach-Object {
$_.Matches } |
ForEach-Object{
$_.Value
}
foreach ($_ in $TPS){
if (!(Test-Path -path "C:\Projects\Cache_Logs\$_")){
New-Item "C:\Projects\cache_logs\$_" -type directory |
Out-Null
}
}
$Split = foreach ($_ in $projects){split-path -path $_}
$RepSplit = $Split -replace ':\\','_'
0..($TPS.Count - 1) |
ForEach-Object {
$jav += java "$xmx" "$xms" -jar C:\bin\verifier.jar `
$($Projects[$_]) $($TIMS[$_]) `
C:\config\verifier.properties >C:\Projects\Cache_Logs\$($TPS[$_])\$($RepSplit[$_])_$($TPS[$_])_Verifier.log
}
}
Start-VPN; Set-INI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment