im OS
rem add user
net user APP_OP mypassword /ADD /y
rem add group
net localgroup LOCAL_APP_USERS /ADD
rem add user to Group
net localgroup LOCAL_APP_USERS APP_OP /ADD
im SQL Server
USE [master];
CREATE LOGIN [$(COMPUTERNAME)\LOCAL_APP_USERS] FROM WINDOWS WITH DEFAULT_DATABASE=[db_name_dev];
GO
USE [db_name_dev];
GO
CREATE USER [$(COMPUTERNAME)\LOCAL_APP_USERS] FOR LOGIN [$(COMPUTERNAME)\LOCAL_APP_USERS];
GO
EXEC sp_addrolemember N'app_user_rol' , N'$(COMPUTERNAME)\LOCAL_APP_USERS'
GO
Testen im OS
rem mit dem Windows-User, der dann auf die DB verbinden soll eine Shell öffnen:
runas /user: $(COMPUTERNAME)\APP_OP cmd.exe
rem in dieser Shell danach
rem test mit integrated security
sqlcmd -S localhost -E -d db_name_dev
test connect via sql user auf port 1433
sqlcmd -S tcp:localhost,1433 -U app_user_dev -P aaaaaa -d db_name_dev
exit
test mit integrated security
sqlcmd -S tcp:localhost,1433 -E -d db_name_dev
exit