0

PowerShell - Create AD Groups then Populate Them from CSV

by Jim 16. October 2011 17:57

In my previous post, I explained how to export a .CSV for each group in an OU.  This gives you a .CSV for each group which is named the same as the group name.

  • Some Group 1.csv
  • Some Group 2.csv
  • Some Group 3.csv
  • Some Group N.csv

Now, I need to create those Groups in a new AD.  Here is the script that I used:

Get-ChildItem | foreach { echo $_.Basename } | ForEach-Object { dsadd group -scope u "cn=$_,OU=Groups,OU=Some OU,DC=SubDomain,DC=Domain,DC=TLD" }

This script calls the program DSADD and passes it the correct name (minus the .csv) which is then used to create the Groups.

Next, we run a similar script that walks through those same .CSV's and adds the users to the group with the same name as the .CSV.

Get-ChildItem | foreach { $GN = $_.BaseName; Import-Csv $_ } | foreach { Add-ADGroupMember -Identity $GN -Members $_.SamAccountName }

This works wonderfully well if the column titled SamAccountName has the correct usernames in it.

Tags: , , , ,

PowerShell

0

PowerShell - Export Group Members to CSV

by Jim Bouse 16. October 2011 16:52

This script will export a .CSV for each group in an OU.  The CSV will be named the same as the group name.

Use this code on an Exchange Server:

Get-Group -OrganizationalUnit "Some OU" | ForEach-Object { Get-Group -Identity $_.Name | ForEach { $_.Members } | Get-User | Export-Csv ($_.Name + '.csv') }

 

Use this code on an machine with Import-Module ActiveDirectory loaded:

Get-ADGroup -OrganizationalUnit "Some OU" | ForEach-Object { Get-ADGroup -Identity $_.Name | ForEach { $_.Members } | Get-ADUser | Export-Csv ($_.Name + '.csv') }

* Greg Martin suggested I clear this up...  Thanks!

Tags: , , , , ,

PowerShell

0

PowerShell - Add Users to Group from CSV

by Jim 16. October 2011 14:56

I needed to add users to groups by PowerShell and was having trouble finding examples how to do it.  Here is how I figured it out.

First, you need a CSV of the users's logon names.  My list came from the CSV from:

Get-DistributionGroupMember -Identity 'Some List' | Export-Csv 'list.csv'

The list generated above consisted of alot of fields.  The only one I am interested in for this use is "Alias".  Once I had the list generated from my old AD, I then ran:

Import-Csv 'list.csv' | ForEach-Object { Add-ADGroupMember -Identity "Some New Group Name" -Members $_.Alias }

Remember the script above needs to be a single line.  I had to break it apart so it will fit in the blog format.  It worked like a charm.

Tags: , , , ,

PowerShell

0

PowerShell - Export Mailbox Users to CSV

by Jim 16. October 2011 13:03

This script exports users from an OU to a CSV that can be used by other scripts.  I had to move hundreds of users from one domain to another and modify some user properties during the process.  A CSV file allows you to open the file in Excel and edit the fields as needed.  You can take the output of this script and use it to create uses in a new domain with this script.

Get-Mailbox -OrganizationalUnit "User OU" | Export-Csv -f User_Mailboxes.csv

Export details for all mailboxes for user in OU.txt (76.00 bytes)

Tags: , , , ,

PowerShell

0

PowerShell - Create Users from CSV

by Jim 16. October 2011 11:23

This script creates users via Powershell.  I had to create 500 users in a new Active Directory domain that I had previously exported from an old domain.  This script can be run from the command line in PowerShell.  I have attached a .TXT file with the script if you would like to download it.

You will need a .CSV file with the following columns:

  • Alias
  • UPN
  • Name
  • DisplayName
  • FirstName
  • LastName
  • OU

Import-Csv 'Users.csv' | ForEach-Object { New-ADUser -SamAccountName $_.Alias -UserPrincipalName $_.UPN -Name $_.Name -DisplayName $_.displayname -GivenName $_.FirstName -Surname $_.LastName -Path $_.OU -AccountPassword (ConvertTo-SecureString "Some!Password" -AsPlainText -Force) -Enabled $true -PasswordNeverExpires $false -PassThru } > Import.log

Create users from CSV.txt (349.00 bytes)

Tags: , , , ,

PowerShell

0

Welcome to BlogEngine.NET 2.5

by Jim Bouse 11. June 2011 10:00

If you see this post it means that BlogEngine.NET 2.5 is running and the hard part of creating your own blog is done. There is only a few things left to do.

Write Permissions

To be able to log in to the blog and writing posts, you need to enable write permissions on the App_Data folder. If your blog is hosted at a hosting provider, you can either log into your account’s admin page or call the support. You need write permissions on the App_Data folder because all posts, comments, and blog attachments are saved as XML files and placed in the App_Data folder. 

If you wish to use a database to to store your blog data, we still encourage you to enable this write access for an images you may wish to store for your blog posts.  If you are interested in using Microsoft SQL Server, MySQL, SQL CE, or other databases, please see the BlogEngine wiki to get started.

Security

When you've got write permissions to the App_Data folder, you need to change the username and password. Find the sign-in link located either at the bottom or top of the page depending on your current theme and click it. Now enter "admin" in both the username and password fields and click the button. You will now see an admin menu appear. It has a link to the "Users" admin page. From there you can change the username and password.  Passwords are hashed by default so if you lose your password, please see the BlogEngine wiki for information on recovery.

Configuration and Profile

Now that you have your blog secured, take a look through the settings and give your new blog a title.  BlogEngine.NET 2.5 is set up to take full advantage of of many semantic formats and technologies such as FOAF, SIOC and APML. It means that the content stored in your BlogEngine.NET installation will be fully portable and auto-discoverable.  Be sure to fill in your author profile to take better advantage of this.

Themes, Widgets & Extensions

One last thing to consider is customizing the look of your blog.  We have a few themes available right out of the box including two fully setup to use our new widget framework.  The widget framework allows drop and drag placement on your side bar as well as editing and configuration right in the widget while you are logged in.  Extensions allow you to extend and customize the behaivor of your blog.  Be sure to check the BlogEngine.NET Gallery at dnbegallery.org as the go-to location for downloading widgets, themes and extensions.

On the web

You can find BlogEngine.NET on the official website. Here you'll find tutorials, documentation, tips and tricks and much more. The ongoing development of BlogEngine.NET can be followed at CodePlex where the daily builds will be published for anyone to download.  Again, new themes, widgets and extensions can be downloaded at the BlogEngine.NET gallery.

Good luck and happy writing.

The BlogEngine.NET team

Tags: ,

0

Import MSSQL Spatial Data into Manifold via .vbs script

by Jim 16. January 2011 17:55

A project I am working on requires me to import and overwrite everchanging data from a SQL database into a Manifold .map file.  This .map file is then used to generate WMS tiles that are overlaid over Google Maps.  Here is the quick and dirty script to bring in a table/view from SQL into Manifold and save the .map.

wscript.echo "Beginning Import"
set app = createobject("Manifold.Application")
set doc = app.NewDocument("C:\test_dir\map.map", false)
Set SQLImport=doc.NewDataSource()
SQLImport.ConnectionString = "DRIVER={SQL Server};SERVER=.\SQLExpress;UID=user;PWD=pass;DATABASE=database"
SQLImport.ConnectionType ="SQL Server"
TableName= "dbo.TABLE_NAME.Geometry"
SQLImport.ImportDrawing (TableName)
doc.Close(true)
set SQLImport = nothing
set doc = nothing
set app = nothing
wscript.echo "Ended Import"

Tags:

Mapping

0

Google Map Mashup with WMS

by Jim 12. February 2010 15:41

I have found that Google does a good job with generic data but often a company needs to display their GIS data on a Google Map.  This is often the case when the general public is viewing the data and doesn't want to learn how a 'heavy' IMS website works.  In this case, I often suggest a Google Map Mashup using a WMS.

The Mashup gives us a few great features:

  • Ease of use
  • Speed of deployment
  • Capacity to scale (if using a cache of generated tiles)

You'll need a few things to get started:

  1. A place to host the website (this can be 'localhost' if you are developing and testing on the same machine)
  2. A working WMS (I assume you have one of these if you are trying to create a mashup.)
  3. A Google Map API key
  4. A Snippet of code that helps generate the request to the WMS (Found Here).

I have attached a simple example that you will need to put on your server and change the WMS layers.

WMS_Google_Mashup.txt (2.72 kb)

Tags: , ,

Mapping

0

Google Maps Mashup with SQL 2008

by Jim 6. February 2010 10:16

I recently began working with SQL 2008 Spatial tools to build a Google Maps Mashup that was part of a larger work order management system for a land surveying company.  The ease of going from SQL to the Google API made it a breeze.

I had a few requirements:

  1. Dynamically place markers on the map based on database critera.
  2. Color those markers according to the values for each record in the database.
  3. Create a visually appealing map.
  4. Be fast.  My primary users are on a limited 400kbps DSL connection so speed is everything.

First, I used Manifold GIS software to get my data ready for use. This included moving the data into a SQL 2008 DB out of SHP file.  We chose Manifold GIS for a few reasons.  Mostly price, then also the great number of data formats that it can open and save as.

Second, I wrote a ASP page that ran on the server that accepted the bounding box of an area and then return a delemited list of results with Lat,Lon along with other attribute data.  This is very simlilar to a WFS but greatly trimmed down.

Third, I wrote a Javascript HttpXmlRequest function that would get the getBounds() function from the Google Map API and pass it to the script described in the second step.  Upon the ASP script returning a list, the Javascript would parse this list and place markers at appropriate locations on the map.

Code Samples:

  1. GIS Code
  2. ASP Code
  3. JS Code

Tags: , ,

Mapping

0

Hurricane Ike Pictures

by Jim Bouse 13. September 2008 02:10

Tags:

Life

Powered by BlogEngine.NET 2.5.0.6
Original Design by Laptop Geek, Adapted by onesoft