Ads 468x60px

Friday, 30 January 2015

Export User list set for PasswordNever Expire

Click on the below link, one of the best books to purchase and get started with Powershell scripting



Finding users whose password is set to never expiry.

To export the user's whose attributes are set for password never expiry through powershell cmdlets.

Please use the below commands.

Get-ADUser -Filter  'PasswordNeverExpires -eq $true'  -Server "domain name" | select name > c:\users.txt

Here we have used Get-aduser cmdlets and filter to show all users whose password is 
Set to enabled.
We’re piping the output with cmdlets “select-object” and to show the output with “Name” attribute.



Note:-
o   Run powershell  as administrator
o   Import-module activedirectory
o   Set-execution policy unrestricted  



Set bulk user account to password never expiry option



Friends, couple of days ago I'd a task to set bulk user account attribute to Password never expiry option.

If the account list consist more then 50+ users records then it is pretty difficult to set the option manually.

Microsoft has provided powershell command line utility which comes into picture and makes your task very easy in no time.

Here is the command to set the attribute to Password never expiry,

Before you run the command, you need to understand it well and check the dependency things related to this commands

Get-content c:\user.txt | set-aduser -passwordneverexpiry $true
or

get-content “c:\users.txt” | Set-QADUser -ObjectAttributes @{useraccountcontrol=65536}

The above command will extract the provided logon names from the text format and command Set-QADUser command will not run unless you have Quest Powershell Management Pack installed and imported into powershell.

Here is the link to download the Quest powershell Management pack:

Note;- Always run Powershell with Administrator Privileges.






How to stop windows from automatic shutdown

We might have come across many times while using windows evaluation OS version, so when the trail periods expiry it’s tend to reboot frequently, the automatic shutdown triggers every hour. Microsoft has made it very clear that - you should activate the product online within 10 days after installing.

-If you’re using eval period to overcome this, we need to re-install the Operating system freshly.
This is usually caused due to process/service which runs in background "Windows License Monitoring Service” it basically monitors the license state of the system and if it has expires it triggers the shutdown.

Our’ recommendation is to stop/remove the WLMS service. But this tutorial does not encourages to promote the piracy but helps people who have issue in running windows for an hour and want to copy their important data.

Download the PSTOOL from the below link:


Save the unzipped folder in c drive

Run the command as administrator

Navigate to the Pstool folder
   
Run the below command:

psexec -i -d -s cmd

which opens a new cmd with nt authority\system account

Now, here type: whoami

Will show nt authority\system account

Type sc delete WLMS
This will delete the services

Type regedit
Above command will open the registry editor

Navigate to: HKEY_LOCAL_MACHINE->System->CurrentControlSet->Services
Right click on: WLMS key and delete

This is how it will work and your machine will not reboot frequently.