Author Archives: Jeff Turner

About Jeff Turner

Technical director of Nano Tera Network Solutions.

Get list of Active directory groups and members

$allgroups=get-adgroups $t = foreach ($g in $allgroups) { $m = get-adgroupmember $g foreach ( $me in $m ) { $me | add-member -membertype noteproperty -name “groupname1” -value $g.name -force } $m | select } $t | select *groupname, name | … Continue reading

Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on Get list of Active directory groups and members

Archiving windows event logs.

If you select the option in windows event logs to archive old event logs it will create files of the format that event viewer can open. An event ID 1105 will be created as the first item in the new … Continue reading

Posted in Hints and Tips, System Administration | Comments Off on Archiving windows event logs.

Backing up SQL Express Databases

A scheduled script such as this which has hard coded the name of the sql command file, set it to run in the folder containing the backups echo %0 starting date /t time /t dir sqlcmd -S localhost\caserver -i “%programfiles%\custom\sql_express_database_name_backup.sql” … Continue reading

Posted in Hints and Tips, System Administration | Comments Off on Backing up SQL Express Databases

Giving permissions in Exchange for users from a trusted domain.

After a recent consolidation we needed to give users in a seperate (but trusted) domain access to mailboxes on an exchange 2010 server. The below code (copied from https://social.technet.microsoft.com/Forums/exchange/en-US/d2f051f0-9649-4ac0-8e82-9783a34d0eed/how-do-you-grant-full-mailbox-permissions-to-someone-in-a-different-domain-in-exchange-2010?forum=exchange2010 – by J. Duke Rogers Communicore Technologies & Triangle Forensics) does … Continue reading

Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on Giving permissions in Exchange for users from a trusted domain.

get the total number of items in all folders of outlook mailbox store

If you are ever moving large amounts of email around it can be useful to be able to check that there is the correct number of emails in the old and new locations. This code generates a text file that … Continue reading

Posted in Hints and Tips, Powershell, VBS, VBA and other scripting. | Tagged | Comments Off on get the total number of items in all folders of outlook mailbox store

Self Signed Certificates.

Allows you to create longer lasting self signed certificates for testing new-selfsignedcertificate in powershell is pretty good but doesnt allow more than 12 months expiration. selfssl7 allows up to 50 years and 2048 bit size. Its default behavior is to … Continue reading

Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on Self Signed Certificates.

export all mailboxes exchange 2010

To do a bulk mailboxexport on exchange 2010 for all mailboxes, it mus tbe to a share and the share needs appropriate permissions. Filter the get-mailbox to get a subset of the mailboxes. $a=get-mailbox foreach ($u in $a) { $u.alias … Continue reading

Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on export all mailboxes exchange 2010

excel get domain from email address

=RIGHT(C2,LEN(C2)-SEARCH(“@”,C2))

Posted in System Administration | Comments Off on excel get domain from email address

GetMailboxStatisticsAndEmail.PS1

Script to export a list of all the mailboxes in an organisation and send the results as attachments to an email. Gives a list ordered by size and after that ordered by last logon time (to hilight old inactive mailboxes). … Continue reading

Posted in Powershell, VBS, VBA and other scripting., System Administration | Comments Off on GetMailboxStatisticsAndEmail.PS1

get_programs_installed_local.ps1

export a list of all software installed on this windows computer. writes to a csv file in the “current” folder. # # # $COTSInstalledSoftware = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ | Get-ItemProperty $COTSInstalledSoftware += Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ | Get-ItemProperty IF (Test-path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\) { $COTSInstalledSoftware … Continue reading

Posted in Powershell, VBS, VBA and other scripting. | Comments Off on get_programs_installed_local.ps1