Posts

Showing posts from April, 2015

"Lastlogon" Or "Lastlogontimestamp”

"Lastlogon" Or "Lastlogontimestamp” -           Last day I got a little chat with my management regarding migrating some Active directory users from an old domain to our new domain. -           Now before talking about policy differences between the old and the new, we came to know that there are many dummy accounts in the old domain, so before migration, we wanted to know the active users who are logging in at least once in the month.   -           I already know about “Lastlogon” and “lastlogontimestamp” attributes, but I was confused which one I should retrieve…   -            After some research, I found that both can be used, but the most accurate one is “lastlogon”, but the problem is this attribute will not replicate to other domain controllers, for example:   -           Let’s say I have one pc, one user and 3 domain controllers(DC1, 2, and 3), the pc send an authentication request to DC1, the “lastlogon” attribute for usr1 will ta

Use Secure password in your powershell code without a prompt

Image
Use Secure password in your powershell code without a prompt - Yesterday i was running a script where i had to type my credentials(Username and password) to get the mandatory results from it, now Normally if you want to use your credentials with one time prompt that will take your information and apply it where ever it is required, you can use somthing like this : you can notice in that when you type : Get-Credential -UserName "Domain\UserName" -Message "Some Message" that you will get a prompt asking you for your password, once you put the password this credential can be use any where in the code when it's required, of course you can assign the CMDLET to a variable and you can use this variable anywhere you want, for example: $cer = Get-Credential -UserName "Domain\UserName" -Message "Some Message" now this is great if i am running a code every time by myself, but what if i want to schedule some code, and this code needs my