-
September 16th, 2009, 04:33 AM
#1
Block user login or let user login certain hours, windows policies?
Hi!
I have a little problem with an application I've making.
I need to let login on windows ( only for one user ) and only between certain hours, for example from 17:00 to 22:00, or maybe block the rest of hours, but I can't find any import or using that let me make this.
I've only found something trought VBScript, but would like to make all with C#.
Thanks a lot
-
September 16th, 2009, 05:22 AM
#2
Re: Block user login or let user login certain hours, windows policies?
How this should work?
Running your application means: to be logged in BEFORE.
-
September 16th, 2009, 06:22 AM
#3
Re: Block user login or let user login certain hours, windows policies?
I know that, but if I run my app as a service I think I could make it work, but I don't know how..
-
September 16th, 2009, 06:41 AM
#4
Re: Block user login or let user login certain hours, windows policies?
while creating a C# a project using .NET select "Service" type and implement your code in that and run the application as service it should work fine.
-
September 16th, 2009, 08:27 AM
#5
Re: Block user login or let user login certain hours, windows policies?
Originally Posted by vcdebugger
while creating a C# a project using .NET select "Service" type and implement your code in that and run the application as service it should work fine.
Thanks for it, but anyone know how I can let login to windows only in certain hours?
Thanks
-
September 16th, 2009, 10:34 AM
#6
Re: Block user login or let user login certain hours, windows policies?
Do you have Active Directory installed on your network? The only way I can think of is to have an application change a users available login times. Never done it before but there are plenty of tutorials on how to interact with AD in C# i'm sure you can find something.
I doubt there is a simple way to do this. Restricting login to a computer is handled by the OS. I don't understand why you need to create an application to do this when windows has this built in?
-
September 16th, 2009, 10:54 AM
#7
Re: Block user login or let user login certain hours, windows policies?
I understand your questions.
The enviroment is the following:
there isn't a network, is a single pc of a particular house, then I haven't active directory. And this pc doesn't have to let login until 22:00.
And I need to make this with C#, I think I can make it with VBScript but if I can, i prefeer C#.
Windows Vista has something similar I've making, but I need to make it for a windows xp.
Thanks.
-
September 16th, 2009, 01:29 PM
#8
Re: Block user login or let user login certain hours, windows policies?
Just go to cmd panel and run this command if you have Windows XP Pro
Code:
net user username /time:M-F,08:00-17:00
to remove it do
Code:
net user username /time:all
-
September 17th, 2009, 02:48 AM
#9
Re: Block user login or let user login certain hours, windows policies?
Thanks but I know that command and I didn't want to make trought msdos, because user will change it for sure.
Anyway I'll try with net user /time with redirectoutput but I've looking for other solution.
Thanks.
-
September 17th, 2009, 09:28 AM
#10
Re: Block user login or let user login certain hours, windows policies?
Only administrators can change the login times. A regular user will not be able to change it. Likewise, anything a C# program can do a user can undo manually.
-
September 17th, 2009, 05:10 PM
#11
Re: Block user login or let user login certain hours, windows policies?
Originally Posted by uoah
Thanks but I know that command and I didn't want to make trought msdos, because user will change it for sure.
Anyway I'll try with net user /time with redirectoutput but I've looking for other solution.
Thanks.
Why would the user change it? You can certainly execute the command with a hidden console window using CreateProcess or ShellExecEx. The user would have no idea if you changed the time.
At any rate, if your program runs under the same account as the user, anything your program can do, the user can undo.
-
September 18th, 2009, 03:42 AM
#12
Re: Block user login or let user login certain hours, windows policies?
Originally Posted by Arjay
Why would the user change it? You can certainly execute the command with a hidden console window using CreateProcess or ShellExecEx. The user would have no idea if you changed the time.
At any rate, if your program runs under the same account as the user, anything your program can do, the user can undo.
Thanks for your replies.
At the end, I've made trought cmd with net use /time, and I'll update every x minuts.
The user would change it because is a child who stays a lot of hours in the pc, and his parents doesn't want it. If he knows ( or search a little on google ) he find the way to unblock, but if I check every x minuts, if he unblock it, my program block again.
Thanks.
-
September 18th, 2009, 09:27 AM
#13
Re: Block user login or let user login certain hours, windows policies?
Change the user's account to a regular user (instead of admin or power user) and remove the time change policy from regular user accounts so the user can't change the time.
-
September 18th, 2009, 09:38 AM
#14
Re: Block user login or let user login certain hours, windows policies?
Originally Posted by uoah
Thanks for your replies.
At the end, I've made trought cmd with net use /time, and I'll update every x minuts.
The user would change it because is a child who stays a lot of hours in the pc, and his parents doesn't want it. If he knows ( or search a little on google ) he find the way to unblock, but if I check every x minuts, if he unblock it, my program block again.
Thanks.
You realize that no matter what you do the kid can undo it. The kid can stop your program from running if hes on the computer. Reverse the /time command and continue playing. Like a few of us have already said make the kid a (non-admin) user and change the /time of his login. He will not be able to change it unless he logs in under an admin account.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|