Wednesday, September 23, 2015

Shavlik Bulliten ID to QNumbers

Recently I have started to help with our monthly patching at our organization. Being a healthcare facility we have a few applications in which we are only allowed to deploy specific patches to those servers. To help speed up the process of preparing patch groups and patch scans within Savlik Protect, I have created a PowerShell Script to take a list of Bulletin IDs (MS15-001) and export a list of associated QNumbers which can then be used to import into shavlik when creating a patch scans. I hope to create a future script to allow bulk updating of an existing patch group with a list of known patches.

Friday, September 5, 2014

Cisco 7861 Speed Dial Template

Here is a nice speed dial template I created for the Cisco 7861 Phone. This template is a directory style mail merge to allow your excel sheet to have one row for each phone you need a line card printed for. One page will have 6 line cards when the merge is finished.

Here is a link to download the file. Download Template

Enjoy!

Friday, July 25, 2014

Removing Old Exchange Mailboxs From Outlooks Folder View

Recently I had an issue where some old Exchange Mailboxes that I had full access to had been deactivated or I had removed my full access permissions, but they were not being removed from my folder view in outlook. I found that to resolve the issue if I went to the properties of the account that was still appearing in my navigation pane using ADSI Edit or doing a Get-ADuser -Identity -Properties MsExchDelegateListLink
the output would show my account still listed as a delegate. to remove my account and any other account in that property I did a set-aduser -Identity -Clear MsExchDelegateListLink

Closed and re-opened Outlook and a few minutes later the accounts were removed from my folder view.

Thanks to this Blog post for pointing me in the correct direction
http://social.technet.microsoft.com/Forums/office/en-US/87637d40-3801-4282-9df1-e519759aee07/cannot-remove-additional-mailbox

Tuesday, May 27, 2014

On Prem Cisco WebEx SSL Certs

Recently I was asked to help get our wildcard SSL Cert installed on our WebEx box. During the install the deployment team found that they would receive an error that the "certificate does not form a valid chain". a quick search found this nice little article on how WebEx expects the cert to be prepared for import.

How to: http://ril3y.wordpress.com/2014/01/22/ssl-with-intermediate-certificates-for-on-premise-webex/

following the instructions from the above site I created a PEM file that had all the certificate info and we were able to successfully import the cert.

using open SSL to Extract Private Key and Public Key from a PFX
http://anuchandy.blogspot.com/2012/04/extracting-public-certificate-and.html

Wednesday, March 5, 2014

Copy Group Membership from one Domain to Another

As a part of my job as a systems engineer I have the opportunity to work on a couple of  acquisitions. During the integration process we found a need to copy the AD security groups used to control access to shares for shared data.  Here is a little PowerShell script that I wrote that uses a CSV to map each user between the two domains. 

Prerequisites
-A CSV mapping the usernames of each user from the source domain to the userid in the destination domain. headers for CSV (SrcDomain-UserName,DestDomain-UserName)
-Read access in the source domain
-Read/Modify rights in the destination domain
-A matching group on in the destination. (Group A in the source  is named Group A in the destination)


#Copies group membership of groups from one domain to another. 
# It uses a CSV to map users between the 2 domains.
# ChangeLog
# 3/3/14-Added logging process for users who might already be in the destination group.

Import-Module ActiveDirectory

$SourceGrps=@()
$DestGrps=@()
$NewuserInfo=@()
$Compare=@()

$RemoteDomainCredential=Get-Credential "username@domainname"

$RemoteDomain="Something.org" #DomainNmae of the Source domain

$LogFile=""

$Csv=Import-Csv -Path "UserMap.csv"

$SourceGrps=Get-ADGroup -Filter * -SearchBase "OU=Groups,DC=Something,DC=org" -Server $RemoteDomain  -credential $RemoteDomainCredential  |Sort{ $_.Name.Substring(1)}

$DestGrps=Get-ADGroup -Filter * -SearchBase "OU=Groups,DC=newdomain,DC=org" |Sort{ $_.Name.Substring(1)}

$Compare=Compare-Object -ReferenceObject($SourceGrps) -DifferenceObject($DestGrps) -PassThru -Property Name

#$Compare the groups in the source and destination domain. ensuring only groups that exist in both domains are copied

ForEach ($Commparison in $Compare){

Write-Host $Commparison.sideIndicator

$Temp=$Commparison.Name

       if ($Commparison.sideIndicator -eq "=>"){

              Add-Content -Path $LogFile "$Temp Was Found in the Destination but not In the Source"

       }ElseIf ($Commparison.sideIndicator -eq "<="){

              Add-Content -Path $LogFile "$Temp Was Found in the Source but not In the Destination"

              $SourceGrps.remove($temp)

       }

}

foreach($Group In $SourceGrps){

       $NewuserInfo=@()

       $SourceGroup=$Group.Name

       $GrpUsers=Get-ADGroupMember -Identity $Group -Server $RemoteDomain  -credential $RemoteDomainCredential

       Write-Host $Group.Name

       Write-host $GrpUsers.count

       if ($GrpUsers.Count -eq $Null) {

              Add-Content -Path $LogFile "$SourceGroup,,Source Group, Group is Empty"

       }Else{

              foreach($User in $GrpUsers){

                     $SourceUser=$User.Name

                     #Add logic for no results log

                     $Result = $CSV | Where{$User.SamAccountName -eq $_.SrcDomain-UserName}

                     if ($Result -ne $null){

                           $NewuserInfo += $Result

                     }Else{                    

                           Add-Content -Path $LogFile "$SourceGroup,$SourceUser,Source Group, User not found in CSV (Failure)"

                           sleep 1

                     }

              }

              $User=$null

              Foreach($User in $NewuserInfo){

                     $DestUserName=$user.DestDomain-UserName

                     $DestGroupName=$Group.Name

                     Try{

                           #writing Group Members in destination Group
                           Add-ADGroupMember -Identity $DestGroupName -Members $DestUserName 

                           Add-Content -Path $LogFile "$DestGroupName,$DestUserName,User Added to Group (Success)"

                           sleep 1

                     }

                     catch [Microsoft.ActiveDirectory.Management.ADException]{

                           if ($_.psbase.Exception.ErrorCode -eq 1378){ #Get Errorcode from $Error[0]

                                  Add-Content -Path $LogFile "$DestGroupName,$DestUserName,User Already in Group"

                                  sleep 1

                           }else{

                                  throw

                           }

                     }

              }

       }

}

Monday, December 23, 2013

Copy AD Group members from one group to another

Here is how using Powershell you can copy the members of an Active Directory group from one group to another.



That is all.

Wednesday, November 21, 2012

PowerShell Script to Search Distribution List Members Mailboxes

Here is a powershell script to search the mailboxes of a specified distribution list. I would run it from the Exchange Management Shell so you have access to all the Exchange cmdlets.



Link to Search-Malbox Cmdlet documentation
http://technet.microsoft.com/en-us/library/dd298173(v=exchg.141).aspx

Exchange Search keywords

Property Example Search results 
Attachmentsattachment:annualreport.pptxMessages that have an attachment named annualreport.pptx. The use of attachment:annualreport or attachment:annual* returns the same results as using the full name of the attachment.
Cccc:paul shenMessages with Paul Shen in the Cc field.
cc:pauls
cc:pauls@contoso.com
Fromfrom:bharat sunejaMessages sent by Bharat Suneja.
from:bsuneja
from:bsuneja@contoso.com
Keywords in retention policyretentionpolicy:business criticalMessages that have the Business Critical retention tag applied.
Date when messages expire according to policyexpires:4/1/2010Messages that expire on April 1, 2010.
Sentsent:yesterdayAll messages sent yesterday.
SubjectSubject:"patent filing"All messages where the phrase "patent filing" appears in the Subject field. 
Toto:"ben smith"Messages that have Ben Smith in the To field.
to:bsmith
to:besmith@contoso.com

AQS: http://technet.microsoft.com/en-us/library/bb232132.aspx#