Skip to main content

Create New Active Directory Users with Excel and PowerShell

Import users from an Excel spreadsheet

Even if you don’t create new users in bulk often, when you have more than one new user to deal with, importing from a comma-delimited file is faster than using the GUI server administration tools or manually typing PowerShell commands. Just fill out the fields in the spreadsheet, run the script and the job is done.
Use an Excel spreadsheet to import new Active Directory users (Image: Russell Smith)
Use an Excel spreadsheet to import new Active Directory users (Image: Russell Smith)
In the script below, I’ve used a simple foreach loop and the import-csv cmdlet to import and generate the new user accounts. The only additional code I’ve added is a split to separate users’ first and second names in the .csv file’s Name field, to populate the –givenName and –surname parameters, for the sake of completeness and to keep the number of columns in the .csv file to a minimum.
Save the script as a .ps1 file. The default PowerShell script execution policy in Windows 8 is set to Restricted, so if you’ve not run PowerShell scripts before, you might need to set the execution policy to Remote Signed, which allows local unsigned scripts to run. Run get-executionpolicy to see the current policy on your machine and set-executionpolicy remotesigned to change the policy if necessary.
Now fill out the columns in the .csv file as shown in the image above as appropriate, save it and run the script.

Comments

Popular posts from this blog

How to remove zabbix-agent from Ubuntu 16.04 (Xenial Xerus)

Uninstall zabbix-agent To remove just zabbix-agent package itself from Ubuntu 16.04 (Xenial Xerus) execute on terminal: sudo apt-get remove zabbix-agent Uninstall zabbix-agent and it's dependent packages To remove the zabbix-agent package and any other dependant package which are no longer needed from Ubuntu Xenial. sudo apt-get remove --auto-remove zabbix-agent Purging zabbix-agent If you also want to delete configuration and/or data files of zabbix-agent from Ubuntu Xenial then this will work: sudo apt-get purge zabbix-agent To delete configuration and/or data files of zabbix-agent and it's dependencies from Ubuntu Xenial then execute: sudo apt-get purge --auto-remove zabbix-agent

Install Zabbix Agent on Suse Linux and Configure

Install taken from Suse –  http://software.opensuse.org/download/package?project=server:monitoring&package=zabbix-agent For SLE 12 SP1 run the following as root : zypper addrepo http://download.opensuse.org/repositories/server:monitoring/SLE_12_SP1/server:monitoring.repo zypper refresh zypper install zabbix-agent For SLE 12 run the following as root : zypper addrepo http://download.opensuse.org/repositories/server:monitoring/SLE_12/server:monitoring.repo zypper refresh zypper install zabbix-agent For SLE 11 SP4 run the following as root : zypper addrepo http://download.opensuse.org/repositories/server:monitoring/SLE_11_SP4/server:monitoring.repo zypper refresh zypper install zabbix-agent For SLE 11 SP3 run the following as root : zypper addrepo http://download.opensuse.org/repositories/server:monitoring/SLE_11_SP3/server:monitoring.repo zypper refresh zypper install zabbix-agent To configure the agent – Instructions taken from – https://www.zabbix.org/wiki

Zabbix alert Notification with Telegram

Zabbix Notifications with graphs in Telegram. Features  Graphs based on latest data are sent directly to your messenger  You can send messages both in private and group chats  Channels support  Saves chatid as a temporary file  Simple markdown and HTML are supported  Emoji in messages First of all : Nedd to install python (>3) on Cent os  # yum -y install python-pip # yum install -y https://centos7.iuscommunity.org/ius-release.rpm #  yum install -y python34u python34u-libs python34u-devel python34u-pi # yum -y install python-pip You need to install the  requests  module for python, this is required for operation! # pip install requests Put  zbxtg.py  in your  AlertScriptsPath  directory, the path is set inside your zabbix_server.conf (once confirm by zabbix server conf file ) Link to download ZBXTG.PY file  https://drive.google.com/open?id=0BxB8j19aCMZ8dFl1aHVuLVJyRjQ # cp zbxtg.py /usr/local/share/zabbix/alertscripts/ Create