|
| |
| |
|
WISE
SCRIPTS - ISQL.EXE
Check if sign-on has sa privilege to run ISQL
commands.
|
- Rem ***** Start - SQL Server check user has sa privileges
- Rem ***** http://www.mcdbadirectory.com - by mark wehmhoefer
10/26/2000
- Rem ***** WISE script for finding if user has sa privileges
- Rem Build the commands to get the SQL version
- Delete File(s) %TEMPINFILE%
- Insert Line "set nocount on" into Text File %TEMPINFILE%
- Insert Line "if (select suser_name()) <> 'sa'"
into Text File %TEMPINFILE%
- Insert Line "raiserror ('Login doesn''t have sa
privileges',18,1)" into Text
- File %TEMPINFILE%
- Insert Line "go" into Text File %TEMPINFILE%
- Rem *****Use ISQL with the above tempinfile commands and
output to
- tempoutfile
- Rem ***** %ISQLSWITCHES could be thee values:
- Rem ***** trusted connection = -Syourserver -n -w300 -E
- Rem ***** sql login connection = -Syourserver -n -w300 -E -Usa
-Pyourpsw
- Execute isql %ISQLSWITCHES% -h-1 -i%TEMPINFILE% -o%TEMPOUTFILE%
-
- Rem *****Loop through the ISQL output text file tempoutfile
for any Msg
- (error occurred)
- Set Variable SRCHSTR to Msg
- Read Lines of File %TEMPOUTFILE% into variable LINEIN start
block
- If expression true Left$(LINEIN,4)=SRCHSTR then
- display message "SQL Server Login doesn''t have sa
privileges"
- exit installation
- End
- End
- Rem ***** End - SQL Server check user has sa privileges
|
|
|
|
|