Here is my script to create new users and mailboxes from a csv file containing FirstName,LastName,Alias,Displayname,Password.
Other account properties such as homefolder, group membership, roaming profile etc were set with ADmodify.net.
Homefolders were created and shared with a script.
Save the following as import.ps1 and call from powershell.
## My Import Script 01/09/2008
## Section 1
## Define Database for new mailboxes
$db="exchangeserver\database"
## Define User Principal name
$upndom="mydomain.local"
## Define OU for new users
$ou="mydomain.LOCAL/ou/ou etc"
## Define CSV File with user information
$csvFile="my csv.csv"
## Section 2
## Import csv file into variable $users
$users = import-csv $csvFile
## Section 3
## Function to convert Password string to secure string
function SecurePassword([string]$plainPassword)
{
$secPassword = new-object System.Security.SecureString
Foreach($char in $plainPassword.ToCharArray())
{
$secPassword.AppendChar($char)
}
$secPassword
}
## Section 4
## Create new mailboxes and users
foreach ($i in $users)
{
$sp = SecurePassword $i.password
$upn = $i.Alias + "@" + $upndom
$display = $i.Displayname
New-Mailbox -Password $sp -Database $db -UserPrincipalName $upn -Name $i.Alias -FirstName $i.Firstname -LastName $i.Lastname -SamAccountName $i.alias -DisplayName $display -Alias $i.Alias -OrganizationalUnit $OU
}
Wednesday, September 10, 2008
Can't print from Powerpoint!!!!
Having installed new HP PCL 5 drivers (over Jetdirect tcp ports) and shared the printers from a server i was able to print a testpage from clients, also word documents but not powerpoint.
The answer was to change the defaults in the "Print Processor" within the driver settings.
Initially it was set to "HPCPP5r1" with "NT EMF 1.007" data type changing it to "Winprint" and "Raw" solved all problems
The answer was to change the defaults in the "Print Processor" within the driver settings.
Initially it was set to "HPCPP5r1" with "NT EMF 1.007" data type changing it to "Winprint" and "Raw" solved all problems
Tuesday, July 29, 2008
Create shares script
Automate the sharing of all folders in the current directory as hidden shares ($) with the share permissions of "Domain Admins" Full Control and the "user account associated with the folder" Change (Assuming the folder is named the same as the user name).
Copy the following into notepad and save as Create Shares.cmd:
@echo off
TITLE Creating shares
DIR /A:D /B >Folderlist.txt
FOR /F %%1 IN (Folderlist.txt) DO NET SHARE "%%1$" = "current local path\%%1" /GRANT: "Domain Admins",FULL /GRANT:"%%1",CHANGE
PAUSE
Copy the following into notepad and save as Create Shares.cmd:
@echo off
TITLE Creating shares
DIR /A:D /B >Folderlist.txt
FOR /F %%1 IN (Folderlist.txt) DO NET SHARE "%%1$" = "current local path\%%1" /GRANT: "Domain Admins",FULL /GRANT:"%%1",CHANGE
PAUSE
Monday, June 9, 2008
Backup Exec 12 and ISA 2004
If you need to install the remote agent and then backup an ISA2004 server you need to do the following for communication harmony:
Create user-defined protocol:
Bexec 1025-65535TCP outbound
Create rule for Backup Exec using protocol above plus both RPC protocols from and to both Backup Server and ISA for all users/custom group.
This could still be "tweaked" further by narrowing the port range down to the commonly used ports (check your ISA log). Beware though as these ports are dynamic and could change - hence the range.
Also worth checking the "Backup Exec Remote Agent for Windows Systems" service is running. It should be set to automatic but if you are having problems start it manually.
If your ISA box is picky, also create a protocol "Bexec 10000TCP outbound" to see if this facilitates communications. Also try restarting all the Bexec services on your Backup Server.
Create user-defined protocol:
Bexec 1025-65535TCP outbound
Create rule for Backup Exec using protocol above plus both RPC protocols from and to both Backup Server and ISA for all users/custom group.
This could still be "tweaked" further by narrowing the port range down to the commonly used ports (check your ISA log). Beware though as these ports are dynamic and could change - hence the range.
Also worth checking the "Backup Exec Remote Agent for Windows Systems" service is running. It should be set to automatic but if you are having problems start it manually.
If your ISA box is picky, also create a protocol "Bexec 10000TCP outbound" to see if this facilitates communications. Also try restarting all the Bexec services on your Backup Server.
Free online network utilities
http://centralops.net/co/
Great website to allow you to get info on remote domains, free for 50 requests per day.
Great website to allow you to get info on remote domains, free for 50 requests per day.
Friday, May 23, 2008
Kubuntu 8.04 DVD Playback
I needed playback of commercial DVD's and the default library's and repositories aren't available out of the box. Regrettably automatix is not supported on Hardy Heron which used to be an excellent installer of unofficial programs and librarys.
So the answer is to add the mediabuntu.org repositorys and key which will then allow you to install "libdvdcss" and also the "w32codecs" for good measure (you will also find some amarok updates).
Run the following in konsole:
sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
and then:
wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update
Then Bob's your mother's Brother!
https://help.ubuntu.com/community/Medibuntu
So the answer is to add the mediabuntu.org repositorys and key which will then allow you to install "libdvdcss" and also the "w32codecs" for good measure (you will also find some amarok updates).
Run the following in konsole:
sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
and then:
wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update
Then Bob's your mother's Brother!
https://help.ubuntu.com/community/Medibuntu
Thursday, May 22, 2008
Exchange 2007 Server Role Roadmap
Follow the link for a useful table detailing all aspects of the different roles in Exchange 2007
http://technet.microsoft.com/en-us/library/aa996319(EXCHG.80).aspx
http://technet.microsoft.com/en-us/library/aa996319(EXCHG.80).aspx
Friday, May 9, 2008
Robocopy
So I needed to copy a lot of user files and directory's from a network drive to an external USB drive. I wanted to maintain the folder structure but exclude a common folder name populated throughout the structure called "Application Data". A few file names/paths exceeded the maximum character allowance for NTFS, so i wanted to skip these and continue when encountered. The command which worked was as follows:
Robocopy "source" "destination" *.* /E /R:1 /XD "Application Data"
/E (copy sub directory's, including empty ones)
/R:1 (retry failed copy's once - then continue)
/XD (exclude specified directory)
Doh!!!!!!!!!!!! just found a GUI version of Robocopy:
http://technet.microsoft.com/en-gb/magazine/cc160891.aspx
If you use the GUI it completes almost instantly, this is misleading as it is still running the command hidden - so don't switch off/reboot. If you fire up Task Manager you will see ROBOCOPY.EXE actively running - BEWARE!
Robocopy "source" "destination" *.* /E /R:1 /XD "Application Data"
/E (copy sub directory's, including empty ones)
/R:1 (retry failed copy's once - then continue)
/XD (exclude specified directory)
Doh!!!!!!!!!!!! just found a GUI version of Robocopy:
http://technet.microsoft.com/en-gb/magazine/cc160891.aspx
If you use the GUI it completes almost instantly, this is misleading as it is still running the command hidden - so don't switch off/reboot. If you fire up Task Manager you will see ROBOCOPY.EXE actively running - BEWARE!
Wednesday, May 7, 2008
Exchange 2003 / AD - Restrict sending to a group
I wanted to restrict users in a group from emailing each other as email was being abused and used as an instant messaging service and affecting productivity.
The solution I used was a combination of nice GUI tools and a quick LDAP reference.
So, in my case all the users were in a distribution group within an OU in Active Directory. Therefore I wanted to restrict receiving mail from this distribution group from all members of my chosen group.
This can be done manually via the "Exchange General" tab and the "Delivery Restrictions" button under the user properties in AD (you may need the exchange plug ins installed). But to do this in bulk requires a bit of scripting or "ADModify" - my new favorite tool.
ADModify has many default settings for applying changes to users/groups in bulk but does not have an explicit option for restricting mail from certain sources. The way around this is to use the custom tab (after you have selected your users and clicked next) and create the attribute name "dLMemRejectPerms" (case sensitive i think). You now need an attribute value in the format:
CN=distribution group,CN=ou where this lives,DC=domain,DC=local etc
If you have no idea how to arrive at this use ADSIEdit to browse your Active Directory and view the required attribute but look and don't touch as you can do some damage!
So off you go with those custom attributes and - hey presto!
If you make a mistake you should find an xml file in the same directory as ADModify.exe which will allow you to undo the changes.
Other attributes for the exchange general tab:
http://technet.microsoft.com/en-us/library/aa997251.aspx
The solution I used was a combination of nice GUI tools and a quick LDAP reference.
So, in my case all the users were in a distribution group within an OU in Active Directory. Therefore I wanted to restrict receiving mail from this distribution group from all members of my chosen group.
This can be done manually via the "Exchange General" tab and the "Delivery Restrictions" button under the user properties in AD (you may need the exchange plug ins installed). But to do this in bulk requires a bit of scripting or "ADModify" - my new favorite tool.
ADModify has many default settings for applying changes to users/groups in bulk but does not have an explicit option for restricting mail from certain sources. The way around this is to use the custom tab (after you have selected your users and clicked next) and create the attribute name "dLMemRejectPerms" (case sensitive i think). You now need an attribute value in the format:
CN=distribution group,CN=ou where this lives,DC=domain,DC=local etc
If you have no idea how to arrive at this use ADSIEdit to browse your Active Directory and view the required attribute but look and don't touch as you can do some damage!
So off you go with those custom attributes and - hey presto!
If you make a mistake you should find an xml file in the same directory as ADModify.exe which will allow you to undo the changes.
Other attributes for the exchange general tab:
http://technet.microsoft.com/en-us/library/aa997251.aspx
Subscribe to:
Comments (Atom)
