Guest Count Blackula Posted July 18, 2008 Posted July 18, 2008 Hi everybody. Does anybody know a good webpage or book explaining how to write scripts? I need a script which will compare %clientname% and %username% with a ini file, to decide if the user is allowed to logon to a terminalserver. I want to achieve that specific users can logon only from specific clients to the terminalserver. The specification would be in the ini which will be edited by the customer himself. Thnx in advance, Milenko
Guest Pegasus \(MVP\) Posted July 18, 2008 Posted July 18, 2008 Re: Help needed with Script "Count Blackula" <count.blackula@web.de> wrote in message news:ejQ1w4L6IHA.404@TK2MSFTNGP05.phx.gbl... > Hi everybody. > > Does anybody know a good webpage or book explaining how to write scripts? > I > need a script which will compare %clientname% and %username% with a ini > file, to decide if the user is allowed to logon to a terminalserver. > I want to achieve that specific users can logon only from specific clients > to the terminalserver. The specification would be in the ini which will be > edited by the customer himself. > > Thnx in advance, > > Milenko > There is a fairly comprehensive console command and batch file tutorial here: http://commandwindows.com/index.html. To find out if a user's name is included in an .ini file, you could use this batch file: @echo off type c:\windows\users.ini | find /i "#%UserName%#" > nul || goto Deny {Place your logon commands here} goto :eof :Deny echo. echo Sorry, you're not allowed to log on. echo Press the Space Bar to cose this window. pause > nul The batch file assumes that authorised user names are listed in users.ini like so: #Blackula# #John Doe# When testing your script or batch file, make sure that the user cannot circumnavigate your restrictions by pressing Ctrl+C. Group Policies would be a better way to grant/deny logon rights.
Guest Count Blackula Posted July 18, 2008 Posted July 18, 2008 Re: Help needed with Script Thnx for your quick reply. The script is going to be applied by my loopback policy on the ts. What i dont see (or understand) in your suggestion is the comparison with the clientname. Meaning, user x should only be allowed to logon to the ts from his own pc xyz, user y from pc abc and so on. So in the ini i need entries something like: x = xyz y = abc The customer wants his employees only to be able to logon to the ts from (in the ini) specified clients. But thnx anyway for your efforts, ill check the tutorial maybe ill work it out on my own. greetings, M. "Pegasus (MVP)" <I.can@fly.com.oz> schrieb im Newsbeitrag news:OYHw$DM6IHA.4596@TK2MSFTNGP03.phx.gbl... > > "Count Blackula" <count.blackula@web.de> wrote in message > news:ejQ1w4L6IHA.404@TK2MSFTNGP05.phx.gbl... > > Hi everybody. > > > > Does anybody know a good webpage or book explaining how to write scripts? > > I > > need a script which will compare %clientname% and %username% with a ini > > file, to decide if the user is allowed to logon to a terminalserver. > > I want to achieve that specific users can logon only from specific clients > > to the terminalserver. The specification would be in the ini which will be > > edited by the customer himself. > > > > Thnx in advance, > > > > Milenko > > > > There is a fairly comprehensive console command and batch file > tutorial here: http://commandwindows.com/index.html. > > To find out if a user's name is included in an .ini file, you could use > this batch file: > @echo off > type c:\windows\users.ini | find /i "#%UserName%#" > nul || goto Deny > {Place your logon commands here} > goto :eof > > :Deny > echo. > echo Sorry, you're not allowed to log on. > echo Press the Space Bar to cose this window. > pause > nul > > The batch file assumes that authorised user names are listed > in users.ini like so: > #Blackula# > #John Doe# > > When testing your script or batch file, make sure that the user > cannot circumnavigate your restrictions by pressing Ctrl+C. > Group Policies would be a better way to grant/deny logon rights. > >
Guest Pegasus \(MVP\) Posted July 18, 2008 Posted July 18, 2008 Re: Help needed with Script Your initial post did not contain sufficient details to permit more than a rough guess about your actual requirements. If you wish to restrict each user to launching a TS from his own PC only then you could, of course, compile an .ini file of the following form: #PC1##User1Name# #PC2##User2Name# This would allow you to run a modified test like so: type c:\windows\users.ini | find /i "#%ComputerName%##%UserName%#" > nul || goto Deny "Count Blackula" <count.blackula@web.de> wrote in message news:emMudNM6IHA.2064@TK2MSFTNGP02.phx.gbl... > Thnx for your quick reply. > > The script is going to be applied by my loopback policy on the ts. What i > dont see (or understand) in your suggestion is the comparison with the > clientname. > Meaning, user x should only be allowed to logon to the ts from his own pc > xyz, user y from pc abc and so on. So in the ini i need entries something > like: > > x = xyz > y = abc > > The customer wants his employees only to be able to logon to the ts from > (in > the ini) specified clients. > > But thnx anyway for your efforts, ill check the tutorial maybe ill work it > out on my own. > > greetings, > > M. > > "Pegasus (MVP)" <I.can@fly.com.oz> schrieb im Newsbeitrag > news:OYHw$DM6IHA.4596@TK2MSFTNGP03.phx.gbl... >> >> "Count Blackula" <count.blackula@web.de> wrote in message >> news:ejQ1w4L6IHA.404@TK2MSFTNGP05.phx.gbl... >> > Hi everybody. >> > >> > Does anybody know a good webpage or book explaining how to write > scripts? >> > I >> > need a script which will compare %clientname% and %username% with a ini >> > file, to decide if the user is allowed to logon to a terminalserver. >> > I want to achieve that specific users can logon only from specific > clients >> > to the terminalserver. The specification would be in the ini which will > be >> > edited by the customer himself. >> > >> > Thnx in advance, >> > >> > Milenko >> > >> >> There is a fairly comprehensive console command and batch file >> tutorial here: http://commandwindows.com/index.html. >> >> To find out if a user's name is included in an .ini file, you could use >> this batch file: >> @echo off >> type c:\windows\users.ini | find /i "#%UserName%#" > nul || goto Deny >> {Place your logon commands here} >> goto :eof >> >> :Deny >> echo. >> echo Sorry, you're not allowed to log on. >> echo Press the Space Bar to cose this window. >> pause > nul >> >> The batch file assumes that authorised user names are listed >> in users.ini like so: >> #Blackula# >> #John Doe# >> >> When testing your script or batch file, make sure that the user >> cannot circumnavigate your restrictions by pressing Ctrl+C. >> Group Policies would be a better way to grant/deny logon rights. >> >> > >
Guest Count Blackula Posted July 18, 2008 Posted July 18, 2008 Re: Help needed with Script Thnx again. I implemented it and it works like a charm! "Pegasus (MVP)" <I.can@fly.com.oz> schrieb im Newsbeitrag news:e%23VR$4M6IHA.3696@TK2MSFTNGP04.phx.gbl... > Your initial post did not contain sufficient details to permit more than > a rough guess about your actual requirements. > > If you wish to restrict each user to launching a TS from his own PC > only then you could, of course, compile an .ini file of the following > form: > #PC1##User1Name# > #PC2##User2Name# > > This would allow you to run a modified test like so: > type c:\windows\users.ini | find /i "#%ComputerName%##%UserName%#" > nul || > goto Deny > > > "Count Blackula" <count.blackula@web.de> wrote in message > news:emMudNM6IHA.2064@TK2MSFTNGP02.phx.gbl... > > Thnx for your quick reply. > > > > The script is going to be applied by my loopback policy on the ts. What i > > dont see (or understand) in your suggestion is the comparison with the > > clientname. > > Meaning, user x should only be allowed to logon to the ts from his own pc > > xyz, user y from pc abc and so on. So in the ini i need entries something > > like: > > > > x = xyz > > y = abc > > > > The customer wants his employees only to be able to logon to the ts from > > (in > > the ini) specified clients. > > > > But thnx anyway for your efforts, ill check the tutorial maybe ill work it > > out on my own. > > > > greetings, > > > > M. > > > > "Pegasus (MVP)" <I.can@fly.com.oz> schrieb im Newsbeitrag > > news:OYHw$DM6IHA.4596@TK2MSFTNGP03.phx.gbl... > >> > >> "Count Blackula" <count.blackula@web.de> wrote in message > >> news:ejQ1w4L6IHA.404@TK2MSFTNGP05.phx.gbl... > >> > Hi everybody. > >> > > >> > Does anybody know a good webpage or book explaining how to write > > scripts? > >> > I > >> > need a script which will compare %clientname% and %username% with a ini > >> > file, to decide if the user is allowed to logon to a terminalserver. > >> > I want to achieve that specific users can logon only from specific > > clients > >> > to the terminalserver. The specification would be in the ini which will > > be > >> > edited by the customer himself. > >> > > >> > Thnx in advance, > >> > > >> > Milenko > >> > > >> > >> There is a fairly comprehensive console command and batch file > >> tutorial here: http://commandwindows.com/index.html. > >> > >> To find out if a user's name is included in an .ini file, you could use > >> this batch file: > >> @echo off > >> type c:\windows\users.ini | find /i "#%UserName%#" > nul || goto Deny > >> {Place your logon commands here} > >> goto :eof > >> > >> :Deny > >> echo. > >> echo Sorry, you're not allowed to log on. > >> echo Press the Space Bar to cose this window. > >> pause > nul > >> > >> The batch file assumes that authorised user names are listed > >> in users.ini like so: > >> #Blackula# > >> #John Doe# > >> > >> When testing your script or batch file, make sure that the user > >> cannot circumnavigate your restrictions by pressing Ctrl+C. > >> Group Policies would be a better way to grant/deny logon rights. > >> > >> > > > > > >
Recommended Posts