Powershell to list the rights for each mailbox (who can read others mailboxes)

Just need to put your server name and if you want to not include some of the access rights (ie bes server and backup software etc… just add it to the where clause).


Get-Mailbox -server myserver | Get-MailboxPermission | where {$_.user.tostring() -ne "dontshowme" -and $_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.IsInherited -eq $false} | Select Identity,User,@{Name='Access Rights';Expression={[string]::join(', ', $_.AccessRights)}} | Export-Csv -NoTypeInformation mailboxpermissions.csv

Posted in Powershell, VBS, VBA and other scripting. | Tagged , | Comments Off on Powershell to list the rights for each mailbox (who can read others mailboxes)

Powershell to export list of email forwards on an Exchange Server

this will list all the forwards that are active for mailboxes.


$fwds = get-mailbox | Where-Object { $_.ForwardingAddress -ne $null } | sort Name | select Name, ForwardingAddress

# now get the primary smtp adress of each forward address
foreach ($fwd in $fwds) {
$fwd | add-member -membertype noteproperty -name "ContactAddress" -value (get-Recipient $fwd.ForwardingAddress).PrimarySmtpAddress
}

$fwds | export-csv -path all_forwards.csv

Posted in Hints and Tips, Powershell, VBS, VBA and other scripting. | Tagged , | Comments Off on Powershell to export list of email forwards on an Exchange Server

Powershell to export list of Exchange Server Mailbox email addresses

this powershell snippet will export all the SMTP email addresses used on a mail server, useful to document and check on them.

;
Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}}
 ;

Or to get them all with each address on a new line (for easier importing etc…)

$a=get-mailbox

$objs=@() ; 
foreach ( $u in $a ) {
    foreach ( $ua in $u.emailaddresses ) {
        if ( $ua.prefixstring -ceq "smtp") { 
            $obj=New-Object psobject 
            add-member -inputobject $obj -membertype NoteProperty -name "Alias" -value $u.alias 
            add-member -inputobject $obj -membertype NoteProperty -name "primarysmtpaddress" -value $u.primarysmtpaddress  ; 
            add-member -inputobject $obj -membertype NoteProperty -name "email" -value $ua.smtpaddress
            $objs += $obj  
            }
       }
             
  }

$objs
Posted in Hints and Tips | Tagged , , | Comments Off on Powershell to export list of Exchange Server Mailbox email addresses

Listing files and folders into a document.

Its always been annoying that it isnt trivial to get a list of documents. This powershell code let you create an excel compatible CSV file listing all the files and folders, one with the newest (by creation data) files first.


function export-file-list
{
param ( $foldername)
echo $foldername
$csvfilename1=($foldername + "\dir_listing_by_creation_time.csv")
$csvfilename2=($foldername + "\dir_listing_by_name.csv")
$t = get-childitem -recurse  $foldername |  select fullname, name, lastwritetime, creationtime
foreach ( $f in $t ) {
    $f | fl
	$f1="."+$f.fullname.substring($foldername.length)
	$f.fullname=$f1
    $f1=$f.fullname.substring(0,$f.fullname.length-$f.name.length)
    $f1
    $f | fl
    $f.fullname=$f1
}

$t | select @{Name="Folder";Expression={$_."Fullname"}} , name , lastwritetime , creationtime |  sort creationtime  -descending | export-csv -notypeinformation $csvfilename1
$t  | select @{Name="Folder";Expression={$_."Fullname"}} , name , lastwritetime , creationtime | export-csv -notypeinformation $csvfilename2


}                                                     

export-file-list (  "d:\Shares\Data" )

Posted in Uncategorized | Comments Off on Listing files and folders into a document.

WSS3 sharepoint upgrade to Sharepoint Foundation 2013

WSS3 sharepoint upgrade to Sharepoint Foundation 2013

SBS 2003 and 2007 use the WSS3 version of sharepoint. To upgrade from that to a current version can be a bit tricky. It involves upgrading to the 2010 version of sharepoint foundation and then to 2013. To do this safely install two new servers one for SPF 2010 and one for SPF 2013

Plenty of excellent blog postings explain the details but in summary the steps are:

  1. Make sure your source sharepoint wss3 is up to date (needs to have latest updates for conversion to succeed). You can backup an older one and restore to a current version one for the export.
  2. Make SQL backup using SQL tools or SQLCMD (“”)
  3. Install a foundation 2010 Sharepoint, if you backup is larger than 4 gigs then install it as a farm with SQL server or SQL express R2 (gives 8 gigs). Make sure it is up to date as some earlier versions have issues with upgrade.
  4. Restore the SQL backup of you content database to the new server (either over or into a new database, I did it into a new one called wss_content_wss3 to make it clear it was from the old server.
  5. Reset site collection administrators accounts (needed if not still in domain etc…), check on Alternative mappings. May need to give access via web application for testing.
  6. Once Sharepoint Foundation 2010 version is working do SQL level backup of contentdatabase.
  7. Restore the SQL database to Foundation 2013 server. Make sure this server is up to date
  8. Reset site collection administrators accounts (needed if not still in domain etc…), check on Alternative mappings.
  9. Do upgrade to Claims authentication for user accounts https://technet.microsoft.com/en-us/library/gg251985.aspx
  10. Do Schema database upgrade powershell Upgrade-SPContentDatabase https://technet.microsoft.com/en-us/library/ff607813.aspx

That was simple wasn’t it =)

The things that caused me issues were:

  • If site settings and other editing things give you errors and “list not found” or “object not found” errors check on your site alternative mappings settings.

Fixing new default spacing on menu

SharePoint 2013 has large gaps in the menus on the quicklaunch (and lots of other spots). I guess its for fat fingers on touch screens. We don’t use them so wanted to close it up.

The style to change is (this was padding:5px 20px; – I changed it to 1px (which gives a gap of two I think).

.ms-core-listMenu-verticalBox li.static > .ms-core-listMenu-item { display:block; padding:1px 20px; }

Make this change to your master page (seattle.master in my case).

Posted in System Administration | Leave a comment

ATO Tax calculations in Excel

Some possibly useful excel functions and macros.

save this function in a macro enables excel documnet (xlsm) and then you can use the formula =taxpayable(a1) and it will calculate the tax payable for that gross income.

ATO Tax scales

Australian Tax department “sliding” scales calculation

Function taxpayable(income)
'Stop
If income < 6000 Then
    taxp = 0
    ElseIf income < 35000 Then
        taxp  = 0.15 * (income - 6000)
    ElseIf income < 80000 Then
        taxp  = 4350 + 0.3 * (income - 35000)
    ElseIf income < 180000 Then
        taxp = 17850 + 0.38 * (income - 80000)
    Else
        taxp = 55850 + 0.45 * (income - 180000)

End If
taxpayable=taxp
End Function
Posted in Hints and Tips | Comments Off on ATO Tax calculations in Excel

Changes to twenty ten theme

Based on twenty ten template, add “pretty” pictures with standard width/height for banner headings.

added logo.jpg to images subfolder within template

Added code to header.php to show logo on top of page next to description (logo has white space on rhs).


< id="site-title">
					
						

						
						

					
				>

Altered heading styles to get rid of italics, removed black border around banner headings. Altered background and hover colours of menus.

changes to styles.css

/*
Theme Name: Twenty Ten Child Nano Tera
Theme URI: http://jetsoft.net.au/twentyten-child-nanotera/
Description: waffle
Author: Jeff Turner
Author URI: https://nanotera.com.au/
Template: twentyten
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: childtest
Text Domain: twentyten-child-nanotera
*/


/* =Reset default browser CSS. Based on work by Eric Meyer.
-------------------------------------------------------------- */

html, body, div
/*
LAYOUT: One column, no sidebar
DESCRIPTION: One centered column with no sidebar
*/

.one-column #content {
	margin: 0 auto;
	width: 900px;
}

#site-title {
	float: left;
	font-size: 30px;
	line-height: 36px;
	margin: 5px 0 10px 0;
	width: 700px;
}
#site-description {
	clear: right;
	float: right;
	jet-font-style: italic;
	margin: 5px 0 10px 0;
	width: 220px;
}

/* This is the custom header image */
#branding img {
	border-top: 0px solid #000;
	border-bottom: 0px solid #000;
	display: block;
	float: left;
}


/* =Menu
-------------------------------------------------------------- */

#access {
	background: #000040;
	display: block;
	float: left;
	margin: 0 auto;
	width: 940px;
}

#access li:hover > a,
#access ul ul :hover > a {
	background: #000099;
	color: #fff;
}


#colophon {
	border-top: 4px solid #000099;
	margin-top: -4px;
	overflow: hidden;
	padding: 18px 0;
}

Posted in System Administration | Leave a comment

WordPress web site, now online.

Moved from development environment in test domain to real domain.

Tuning content and appearance.

This site based on a child theme of twenty ten theme.

Planning to move content from the public subsite (dokuwiki) to here if it is relevant. New public hints and tips will go here.

Have installed WP-Geshi plugin so have syntax hilighting similar to that in dokuwiki, dont get the neat download this file link.

Posted in News Announcements | Leave a comment