Friday, September 30, 2011

New material claimed to store more energy and cost less money than batteries

The low-cost, high-density energy-storage membrane, created at the National University of ...
Great discovery if it can make it to market. Finally a solution for electric-powered vehicles and other technologies currently forced to use inefficient batteries. This could be a breakthrough leading us to a new way of using electrical items.
New material claimed to store more energy and cost less money than batteries:

IIS Website Redirection (IIS 7.x)

If you wish to create a website that only connects via HTTPS (port 443) but want to ensure users don't see a blank website or receive an error when they type your URL into their browser, you can create an IIS redirection site.  Here are the steps:

1. Open IIS Manager, right click on Sites, and "Add Web Site..."

2. Name the site something that will help you remember what it's for (I used Redirector) and ensure it's capturing requests going to port 80 (HTTP native port number)

3.  Click on your website and double-click on the HTTP Redirect tool

4.  Type in your redirected website name (i.e. HTTPS://www.yoursite.com) and click Apply.  Web redirection is now in place.  Obviously this not only applies to 443 redirections but pretty much any kind of web redirection -- for instance, a subsite (http://www.yoursite.com/MoreInfo) or different server (http://anotherserver.yoursite.com) altogether.

SharePoint Designer editing for SharePoint Server 2010

If your organization decides to edit/create SharePoint 2010 content via SharePoint Designer, ensure you use the correct version of the designer.  I spent three hours trying to figure out why I kept getting "This web site has been configured to disallow editing with SharePoint Designer."  I created a brand new SharePoint site, ensured the check-boxes were checked and still received that message.  No where in Microsoft's website could I explicitly find a solution.  Finally someone blogged a solution to the problem, mentioning that they installed SharePoint Designer version 2010 and the problem was solved.  Luckily, SharePoint Designer 2010 is a free downloadable application.  Click here to visit the Microsoft site.

Tuesday, September 27, 2011

Fixing SharePoint 2010 Navigation Crumbs

I found a navigation crumb whose link was broken.  The library was working correctly when the user clicked the Library link in the "Quick aunch" left section but the crumb at the top wasn't pointing to the "Forms/AllItems.aspx" page but rather to nowhere. This problem occurs when there's no default view selected for the Library or list.  Perform the following to fix the problem:


  1. Click Site Actions
  2. Click Site Settings
  3. Click Site libraries and lists from the Site Administration section
  4. Click "Customize..." on the library or list that's not working
  5. Scroll down the page until you see Views
  6. You should notice that there is no view checked as Default View
  7. If there are existing views to choose from, make one of them the default
  8. If there are no views, click Create view, and pick "All Documents" at the bottom
  9. Use the defaults and click OK
  10. This will return you to the library/list page where you should see the views section updated
  11. Use your crumb or Quick Launch link to return to the problemed library
  12. Click on the updated crumb at the top of the page, it should be working now

Friday, September 23, 2011

Manipulating FrontPage 2002 Server Extensions in Windows 2008 Server

My recent task was to help move FrontPage 2002 websites from a Windows 2000 server utilizing IIS 5.0 to a new Windows 2008 R1 server with IIS 7.0.  Microsoft stopped supporting FrontPage Server Extensions (FPSE) in IIS 7 so a third party company named Ready-to-Run created a solution.  Beware though, for Windows 2008 R1, there is no need for a separate license server.  But, for 2008 R2, which is IIS 7.5, the FPSE add-on requires a separate license server if Windows 2008 is hosted on a virtual machine.  This requires at least 5 ports to be opened in your firewall plus having a dependency on a another (physical) computer to host the license file and associated program/service.


Adding the FPSE software is relatively easy.  IIS.Net has great information about this process. Warning:  logon as the Administrator and perform all duties as the Administrator, no matter what your user permissions are.  UAC creates unusual and unexpected results if you don't run as Administrator -- especially if running from the PowerShell or Command line.  Another note, ASP from IIS 5.0 uses .Net 2.0 and IIS 7.x uses .Net 3.0 (integrated).


FPSE comes with a powerful command line executable you may want to use if you have several websites, subwebs, and/or users and permissions to populate.  Combined with PowerShell, you can create some simple CSV files, input your information, and build your web environment without having to the use SharePoint Designer GUI in a painstakingly slow building process.


Using IIS, create a parent website that will host the subwebs.  Assign it's IP, port, etc. Use the SharePoint Admin web interface to extend the website with FPSE.  Once created and extended, click on IIS/Sites locate your new websites ID number.  That will be important for the scripts.


Creating subwebs using PowerShell and OWSADM:
The FPSE executable OWSADM.EXE is located in "%systemdrive%\program files (x86)\common files\microsoft shared\Web Server Extensions\50\bin".  Open a cmd.exe window and CD your way to the owsadm.exe location.  This is the syntax for creating a subweb:
owsadm.exe -o create -w /Subwebname -m YourParentSiteID -u InitialSubwebAdmn -pw (don't have to use)
Example:
owsadm -o create -w /TestSubWeb -m 4 -u Administrator -pw MyPa$$w0rd


Once your subsite is created, you can add users and roles.  To do so, follow this syntax:
owsadm -o roleusers -w /Subwebname -c add -u user1,user2,user3 -n Browser -m YourParentSideID
Example:
owsadm -o roleusers -w /TestSubWeb -c add -u Bob,Tom,Wilma -n Browser -m 4
(no spaces between users and commas and for Advanced author use Advauthor)


If you have several websites, subsites, and users, it might be worth your while to create CSV files to import into a couple of PowerShell scripts.  PowerShell is powerful and requires you to run it as Administrator.  Also, you have to turn on scripting for PS via the "set-executionpolicy Unrestricted."  Default is Restricted.  I mention how to change it in a previous blog post.  


Create a CSV for your Subwebs:



ParentWeb,Subweb,Admin,Password
4,2014,dbadmin,password

4,TestSubweb,Admin,password



Save this file as Subwebs.csv in the same folder as you'll run your PowerShell script from (I suggest from the owsadm.exe folder)


Create a PowerShell script:



import-csv Subwebs.csv|foreach {
$parent = $_.ParentWeb
$subweb = $_.Subweb
$admin = $_.Admin
$password = $_.Password
.\owsadm.exe -o create -w /$subweb -m $parent -u $admin
}


In this script I left out the password portion as the user accounts were already created and I ddn't want to jeopardize them.  You can add and use -pw and input the data from column four of the Subwebs.csv, just remember to add -pw $password to the owsadm line.


Once the subwebs are created, you can work on inputting your users and their subweb roles.  Create Webperms.csv and add users and roles:



Subweb,User,Perm
2014,brad,Browser
2014,anslo,advauthor


Save to the owsadm.exe folder then create a PowerShell script:



import-csv Webperms.csv|foreach {
$perm = $_.Perm
$user = $_.User
$subweb = $_.Subweb
.\owsadm.exe -o roleusers -w /$subweb -c add -u $user -n $perm -m 4
}

Now you can consult with your webmaster to get all the information about moving sites over to a new server.  Update the CSV files with the appropriate information and run the PowerShell scripts when you're finished dotting your I's and crossing your T's.  Both owsadm.exe and PowerShell are syntax picky so ensure there's no extra spaces, quotes, or other extraneous marks in your commands or CSV files.


Please leave comments if this article helped you or you need more information.  I wrote it with the assumption that you are well-versed in server administration and some scripting knowledge.  Enjoy!


References:
http://technet.microsoft.com/en-us/library/cc768032.aspx
http://support.microsoft.com/kb/272945
http://support.microsoft.com/kb/838684
http://learn.iis.net/page.aspx/134/installing-the-frontpage-server-extensions-on-iis-7/

Thursday, September 15, 2011

Adding local users (and to a group) via PowerShell

After researching numerous sites over a two-day period, I've finally figured out how to use PowerShell, write a PS script, and complete the transition of users from one local server to another. And, add those users to a group on the new server. Here are the steps necessary to complete the task:

1. Ensure PowerShell has permissions to run scripts by either running the PS command set-executionpolicy unrestricted. I found out that the UAC stops this regkey from being created so I manually added the string value of Unrestricted in the HKLM\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell key.

2. No matter what security privileges you have on your computer, ALWAYS run PowerShell as Administrator. Again, the UAC will cause problems if you don't.

3. All PowerShell scripts have the extension .PS1. Ensure you name your script file accordingly. Also, when running the script, use the current folder . and backslash \ . For instance, I created a folder off the root called PowerShell. To run a script from the same folder, type in .\scriptname.ps1.

4. Create a CSV from your old server by going to the Computer Management MMC, clicking on Local Users and Groups, right-clicking on the Users folder, and selecting Export List. The resulting file will need to be converted from a tab-based file to a comma-based one. Use Excel to create this conversion.

5. Once you have a comma separated list of users, place three entries on the first line of your list of users: Users, FullName, and Description. Use commas between the words. Your CSV file should look something like this:

Users,FullName,Description
Bob,Bob Smith,Accountant
Jane,Jane Thomas,HR Lead
etc...

6. Create a script similar to this:

$target = [adsi]"WinNT://ComputerName"
$group = [adsi]"WinNT://ComputerName/Group1"
Import-CSV users.csv|foreach {
$newuser = $target.Create("user",$_.User)
$newuser.SetPassword("P@ssW0rd")
$newuser.SetInfo()
$newuser.InvokeSet("FullName",$_.FullName)
$newuser.SetInfo()
$newuser.InvokeSet("Description",$_.Description)
$newuser.SetInfo()
$user = "WinNT://ComputerName/" + $_.User
$group.Add($user)
}

Change ComputerName to your servers name. You can abbreviate your server name with . (ie. WinNT://. ) but found adding the user to a group section didn't work unless I explicitly named the server.

The $_. pulls the information from the CSV file based on the column heading name.

7. Ensure you've created the group you want all the new users to be apart of. If you don't want them in any special group, you can edit the script and place # in front of each line that pertains to the group addition. # is a remark character and PS ignores processing for that line.

8. Run the script, ensuring you've pointed it to the correct location of your CSV file. If you've done everything right, you'll simply see PS run the command and go back to the prompt. If something is wrong, you'll see lots of red text.

9. As a precaution, once you've run your script, set-executionpolicy restricted should be done to ensure rogue scripts aren't performed against your server.

Hope this helps you save time and enjoy PowerShell, it's very powerful.