Created
June 20, 2017 15:47
-
-
Save gsherman/3775f3b820f936b84b98b6d00d98f270 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Make sure they supplied 1 param - which is the list element name to search for | |
REM If they didn't, show usage & exit | |
echo. | |
echo *** find lists (gbst and hgbst) that have a given element *** | |
echo. | |
if "%1" == "" goto usage | |
cd /d %~dp0 | |
SET POWERSHELL=%SystemRoot%\SYSTEM32\WindowsPowerShell\v1.0\powershell.exe | |
%POWERSHELL% ./find-gbst-elm.ps1 %* | |
echo. | |
%POWERSHELL% ./find-hgbst-elm.ps1 %* | |
goto done | |
:usage | |
echo. | |
echo Missing arguments! | |
echo Usage: find-element.bat element_title | |
echo Example: find-element.bat deferred | |
echo Example: find-element.bat 'wait on others' | |
echo Example: find-element.bat 'quiet light' | |
echo. | |
:done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################## | |
## SCRIPT: find-gbst-elm.ps1 | |
## | |
## PURPOSE: This PowerShell script finds all application lists that contain a given element | |
## | |
## Call this script like: | |
## find-gbst-elm.ps1 "element to search" | |
## find-gbst-elm.ps1 problem | |
## | |
############################################################################## | |
param([string] $title) | |
$query = "select title as 'Application List Name' from table_gbst_lst where objid in(select gbst_elm2gbst_lst from table_gbst_elm where title = '$title' )" | |
$database = "dovetail"; | |
write-host | |
write-host "Finding gbst_lst records who have an element with a title of:" $title; | |
Invoke-Sqlcmd -Query $query -Database $database |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################## | |
## SCRIPT: find-hgbst-elm.ps1 | |
## | |
## PURPOSE: This PowerShell script finds all user-defined lists that contain a given element | |
## | |
## Call this script like: | |
## find-hgbst-elm.ps1 "element to search" | |
## find-hgbst-elm.ps1 yes | |
## find-hgbst-elm.ps1 "advance exchange" | |
## | |
############################################################################## | |
param([string] $title) | |
$query = "select * from table_hgbst_elm where title = '$title'"; | |
$database = "dovetail"; | |
function FindList(){ | |
foreach( $element in $input){ | |
write-host | |
write-host "Finding list for hgbst_elm.objid:" $element.objid; | |
write-host | |
c:\bin\hgbst-utils\hgbstutils.exe /quiet /db_name $database /db_server . /db_user sa /db_pass sa /elm $element.objid; | |
write-host | |
} | |
} | |
write-host "Finding hgbst_elm records with a title of:" $title; | |
Invoke-Sqlcmd -Query $query -Database $database | FindList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment