Sunday, December 14, 2014
Webhosting
The website (new window) http://www.whoishostingthis.com/ was able to help with this.
Saturday, December 6, 2014
Adding and checking RBL and DNSBL in Exchange 2010
Open the EMC, expand Microsoft Exchange On-Premises –> Organization Configuration –> Hub Transport.
Select the Anti-Spam tab.
Right click on IP Block List Providers and select Properties
Select the Providers tab, and click Add…
Enter the details of the block list provider. EG:
Some basic providers you can use are:
zen.spamhaus.org
dnsbl.sorbs.net
To do the same thing in Exchange Management Shell:
Add-IPBlockListProvider -Name '%NAME%' -LookupDomain '%LOOKUPDOMAIN%' -Enabled $true -BitmaskMatch $null -IPAdressesMatch @0 -AnyMatch $true -Priority '%PRI%' -RejectionResponse ''
Where:
%NAME% is the name you wish to give the DNSBL (Eg: Spamhaus, sorbs, etc);
%LOOKUPDOMAIN% is the domain that is queried (the DNSBL domain) (zen.spamhaus.org, dnsbl.sorbs.net, etc); and
%PRI% is priority, 1, 2, 3, etc
eg:
Add-IPBlockListProvider -Name 'Spamhaus' -LookupDomain 'zen.spamhaus.org' -Enabled $true -BitmaskMatch $null -IPAdressesMatch @0 -AnyMatch $true -Priority '1' -RejectionResponse ''
To check if the RBL is working, or to check if it is rejecting legitimate emails, you can use the following commands from the Exchange Management Shell (mm/dd/yyyy date format, regardless of regional settings):
Get-Agentlog –StartDate “08/22/2014” | where {$_.Reason –eq “BlockListProvider”}
This will list all emails that failed due to Block List Provider from 22/08/2014 to current.
Using Get-Member we can see the properties: Action; Agent; Diagnostics; Event; IPAddress; MessageID; P1FromAddress; P2FromAddresses; Reason; ReasonData; Recipients; SessionID; SMTPResponse; and TimeStamp.
This will list all emails that were rejected that came from *example.org:
Get-Agentlog –StartDate “08/22/2014” | where {$_.Reason –eq “BlockListProvider” –AND $_.P1FromAddress –like “*example.org”}
This will list all emails that were rejected that were addressed to anonit@example.com:
Get-Agentlog –StartDate “08/22/2014” | where ($_.Reason –eq “BlockListProvider” –AND $_.recipients –like “anonit@example.com”}
Show all originating IP addresses that were blocked by a rule called SpamHaus:
Get-Agentlog –StartDate “08/22/2014” | where {$_.ReasonData –eq “SpamHaus} | select-object IPAddress
Saturday, November 29, 2014
Windows Server Backup Logs Location
These logs may be easier to read than the event logs, and give a better indication of any faults. Additionally it will list any files that fail to backup.
NTFS Uncompress entire drive
cd /d c:\
compact /u /s /a /i
It takes a long time to process all the files.
Wednesday, September 17, 2014
Windows Photo Viewer is slow to open
Run the following from an elevated command prompt:
del "%LOCALAPPDATA%\Microsoft\Windows\Explorer\*.db"
Thursday, August 28, 2014
Viewing Delegates with Exchange 2010 and Powershell
Running the command as is:
Get-Mailbox -ResultSize unlimited | Get-CalendarProcessing | where { $_.ResourceDelegates -ne "" } | Select-Object identity,@{Name=’ResourceDelegates’;Expression={[string]::join(",", ($_.ResourceDelegates))}} | Export-csv -Path c:\temp\ResourceDelegates.csv
Will produce a CSV file in c:\temp with column A as the Mailbox, column B, C, etc as the delegates, ready for importing into Excel. The @ symbol and everything after in the {} brackets is an array of the delegates.
You can get the results on a single mailbox (%IDENTITY% is the mailbox alias) by using:
Get-CalendarProcessing -identity %IDENTITY% | select-object ResourceDelegates
In this example, both Lucas Knorr and Nicholas Deane are delegates of Beau Kenny’s mailbox.
To get a list of all delegates for all mailboxes, you can use:
Get-Mailbox | Get-CalendarProcessing | Select-Object Identity, ResourceDelegates
However this has drawbacks, such as including mailboxes that don’t have delegates, and column width limitations. To resolve this, use:
Get-Mailbox | Get-CalendarProcessing | Where {$_.ResourceDelegates –ne “”} | Select-Object Identity, ResourceDelegates | Format-List
Thursday, August 21, 2014
Excel 2010 using If and Conditional Formatting
An If statement in Excel has the following format:
IF(logical_text,[value_if_true],[value_if_false])
Given the following dataset:
We want to make the Column B have values of ‘READ’ or ‘WRITE’, depending on the value of column A. If the value of the cell in column A is 0, the value of the cell in column B should be ‘READ’, a value of 1 in column A should have a value of ‘WRITE’ in column B.
To do this, we enter the following formula in cell B1:
=if(A1=0,”READ”,”WRITE”)
This is evaluated as: if the cell in A1=0, then the value is “READ”, else the value is “WRITE'”
To use conditional formatting based on the value of another cell, imagine the following dataset:
We want to highlight the values in column B with RED if the value in column A is 0, and GREEN if the value is 1.
To do this, select Conditional Formatting, and select New Rule…
Select Use a formula to determine which cells to format, and enter the formula:
=a1=0
Set the format fill to red.
Click OK
Select Conditional Formatting and select Manage Rules…
Enter the Applies to and drag the selection to the range of the cells you wish to have this rule apply to.
Click Apply.
You can see the rule take effect.
To create the second rule to highlight in green, follow the same steps above, but use the formula:
=a1=1
and set the format fill to green
You can also use rules to highlight based on the text or string value of a cell. EG: to highlight a cell if the value in another cell is “RW”, use the formula =a1=”RW”
Thursday, August 14, 2014
Auditing file permissions with Powershell and accesschk.exe
Using the command from powershell:
.\accesschk.exe –s “%DOMAIN%\%USER%” %DIRECTORYTOCHECK% | Out-File %LOGFILE%
eg: to find out which files in the f:\qld\ folder that the user SALES\johnsa has access to, logging to f:\it\access\johnsa.txt
.\accesschk.exe –s “SALES\Johnsa” f:\qld\ | Out-File f:\it\access\johnsa.txt
You can also restrict this to listing the directories that can be accessed, by using the –d switch:
.\accesschk.exe –s –d “SALES\Johnsa” f:\qld\ | Out-File f:\it\access\johnsa.txt
Thursday, August 7, 2014
Setup Exchange 2010 Full Access Permissions
Open the Exchange Management Console
Click Yes on the User Account Control Dialog if it appears
On the left hand side of the screen, navigate to Microsoft Exchange –> Microsoft Exchange On-Premises –> Recipient Configuration
Select Mailbox
Right Click on the user’s mailbox you wish to give access to, and select Manage Full Access Permission…
Click Add…
Select the Name of the user you wish to give access to, and click OK
Click Manage
Click Finish
You can also accomplish this by using Powershell. In this example, Andrew will be given full access to Craig’s mailbox:
Add-MailboxPermission -Identity Craig -User Andrew -AccessRights FullAccess
You can also use groups. In the example below, the group called Sales Users will be given full access to Craig's mailbox:
Add-MailboxPermission -Identity Craig -User "Sales Users" -AccessRights FullAccess
To do bulk changes, you can follow the post here (new window): http://anonit.blogspot.com.au/2014/07/changing-exchange-2010-mailbox.html
Thursday, July 31, 2014
Activesync Device Report Exchange 2010
http://briandesmond.com/blog/how-to-create-an-activesync-device-report/
You can use a single line to get the details of a specific user:
Get-Mailbox -Identity %USER% | ForEach-Object {Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity}
EG: Get the ActiveSync Statistics for user anonit:
Get-Mailbox -Identity anonit | ForEach-Object {Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity}
If users have multiple devices, it may be best to use the EXPORT-CSV cmdlet. EG:
Get-Mailbox -Identity anonit | ForEach-Object {Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity} | Export-CSV ActiveSyncReport-anonit.csv
Thursday, July 24, 2014
Exchange 2010 Tracking logs and Powershell
Name
|
MemberType
|
Definition
|
----
|
----------
|
----------
|
Equals
|
Method
|
bool Equals(System.Object obj)
|
GetHashCode
|
Method
|
int GetHashCode()
|
GetType
|
Method
|
type GetType()
|
ToString
|
Method
|
string ToString()
|
ClientHostname
|
Property
|
System.String ClientHostname {get;}
|
ClientIp
|
Property
|
System.String ClientIp {get;}
|
ConnectorId
|
Property
|
System.String ConnectorId {get;}
|
EventData
|
Property
|
System.Collections.Generic.KeyValuePair`2[[System.String,
mscorlib, Version=2.0...
|
EventId
|
Property
|
System.String EventId {get;}
|
InternalMessageId
|
Property
|
System.String InternalMessageId {get;}
|
MessageId
|
Property
|
System.String MessageId {get;}
|
MessageInfo
|
Property
|
System.String MessageInfo {get;}
|
MessageLatency
|
Property
|
System.Nullable`1[[Microsoft.Exchange.Data.EnhancedTimeSpan,
Microsoft.Exchange...
|
MessageLatencyType
|
Property
|
Microsoft.Exchange.Management.TransportLogSearchTasks.MessageLatencyType
Messag...
|
MessageSubject
|
Property
|
System.String MessageSubject {get;}
|
RecipientCount
|
Property
|
System.Nullable`1[[System.Int32, mscorlib,
Version=2.0.0.0, Culture=neutral, Pu...
|
Recipients
|
Property
|
System.String[] Recipients {get;}
|
RecipientStatus
|
Property
|
System.String[] RecipientStatus {get;}
|
Reference
|
Property
|
System.String[] Reference {get;}
|
ReturnPath
|
Property
|
System.String ReturnPath {get;}
|
Sender
|
Property
|
System.String Sender {get;}
|
ServerHostname
|
Property
|
System.String ServerHostname {get;}
|
ServerIp
|
Property
|
System.String ServerIp {get;}
|
Source
|
Property
|
System.String Source {get;}
|
SourceContext
|
Property
|
System.String SourceContext {get;}
|
Timestamp
|
Property
|
System.DateTime Timestamp {get;}
|
TotalBytes
|
Property
|
System.Nullable`1[[System.Int32, mscorlib,
Version=2.0.0.0, Culture=neutral, Pu...
|
Thursday, July 17, 2014
Forward Emails in Exchange 2010
Open the Exchange Management Console
Expand Microsoft Exchange On-Premise and Recipient Configuration. Select Mailbox
Right click on the mailbox you wish to forward and click Properties
Select the Mail Flow Settings tab. Select Delivery Options and click Properties…
Select Forward To: and click Browse
Select the user you wish to forward emails to, and click OK
If you wish to send the email to the original mailbox and forward it, select Deliver message to both forwarding address and mailbox.
Click OK.
Click OK on the users Mailbox Properties
Close the Exchange Management Console
To do this in Powershell, Open the Exchange Management Shell and use the following commands:
Set-Mailbox –Identity “%IDENTITY%” –ForwardingAddress %ADDRESS%
eg:
Set-Mailbox –Identity “ANONIT” –FowardingAddress anonit@example.com
To deliver both to the mailbox and the forward address, use the –DeliverToMailboxAndForward $TRUE
eg: to deliver to ANONIT and anonit@example.com
Set-Mailbox –Identity “ANONIT” –FowardingAddress anonit@example.com –DeliverToMailboxAndForward $TRUE
Thursday, July 10, 2014
Changing Exchange 2010 mailbox permissions using Powershell
I needed to give a user full control over every users mailbox in an Exchange 2010 environment. After getting the required permissions and authority, I used the following powershell command:
get-mailbox | add-mailboxpermission -user '%ALIAS%' - Accessrights 'FullAccess'
where %ALIAS% is the alias of the user who will be given permissions to the mailbox.
EG: Bob needs access to every mailbox:
get-mailbox | add-mailboxpermission -user 'BOB' - Accessrights 'FullAccess'
Thursday, July 3, 2014
Blackberry link fails to install: Error 1920 Rim Tunnel Service
When trying to install or upgrade the Blackberry Link software on Server 2008 R2, it may fail with:
Blackberry Link Installer Information
Error 1920.Service Blackberry Link Communication manager (Rim Tunnel Service) failed to start. Verify that you have sufficient privileges to start system services.
Starting the service manually logs the following errors:
A timeout was reached (nnnnn milliseconds) while waiting for the Blackberry Link
communication Manager service to connect
and
The Blackberry Link Communication Manager service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion.
Rebooting, run as admin, uninstall the old version, removing files, and old registry keys fail to resolve.
Checking the service, we can see that it executes “%PROGRAMFILESX86%\Research in Motion\Tunnel Manager\tunmgr.exe” with a switch of service.
Attempting to execute this program interactively provides the following error:
tunmgr.exe – System Error
The program can’t start because Wlanapi.dll is missing from your computer. Try reinstalling the program to fix this problem
To resolve this, install the Wireless Lan Service Feature in Service Manager
Alternatively you can install this using Powershell using the following commands:
Import-Module ServerManager
Add-WindowsFeature Wireless-Networking
The Blackberry Link should now install.
Thursday, June 26, 2014
Disable Printer Notifications Server 2008 R2 / Windows 7
To disable printer notifications in Server 2008 R2 / Windows 7
Click Start and select Devices and Printers
Select a printer (it doesn’t matter which one) and select Print Server Properties
Select the Advanced tab, and untick Show informational notifications for network printers. Click OK.
This will disable the printer notifications for this user on this workstation only.
Thursday, June 19, 2014
List files modified between dates in Powershell
I needed to get a list of files modified between 2 dates. I used the following in Powershell. Worth noting is regardless of the date format or regional settings, the date format to be used is mm-dd-yy. The code below will list all files modified between 30 May 2014 and 02 Apri 2014.
get-childitem -recurse | where-object {$_.lastwritetime -gt '05-30-14' -AND $_.lastwritetime -LT '06-02-14' -AND ! $_.PSIsContainer} | select-object fullname
Thursday, June 12, 2014
Shrink a VMware VMDK from command line
I needed to shrink a number of VMWare Workstation 9 virtual disk files (VMDK files) from the command line.
VMWare Workstation 9 doesn’t include the vmware-mount.exe utility, which is needed to mount the drive for preparation. It is also not included in the Virtual Disk Development Kit 5.5, but can be found in version 5.1. You can download this from here, although it may possibly move. Searching the vmware support site for VDDK 5.1 windows may help find it.
Using the powershell script available here can allow you to cycle through a number of VMDK files, additionally perform a contig (available here) to defrag the VMDK files on the physical media.
Thursday, June 5, 2014
Basic Get-ADUser powershell commands
I needed to remove the logon script option in AD for all users of an entire domain. I used the following commands:
Get-ADUser –filter *
This command will list all AD Users
Get-ADUser –filter * | Measure-Object
This command will list the number of users
Get-ADUser –identify ADAdmin –properties *
This command will get all properties of a specific user … in this example, the user is ADAdmin
Get-ADUser –filter * –properties * | Format-Table Name, ScriptPath
This will list the name, and logon script
Get-ADUser –filter * | Set-ADUser –server dc03 –clear scriptpath
This will erase the logon script for all users, running against the server called DC03
Properties you can use with Set-ADUser are:
AccountExpirationDate
accountExpires
AccountLockoutTime
AccountNotDelegated
adminCount
AllowReversiblePasswordEncryption
BadLogonCount
badPasswordTime
badPwdCount
CannotChangePassword
CanonicalNameCertificatesCity
CN
codePage
Company
Country
countryCode
Created
createTimeStamp
Deleted
Department
Description
DisplayName
displayNamePrintable
DistinguishedNameDivision
DoesNotRequirePreAuth
dSCorePropagationData
EmailAddress
EmployeeID
EmployeeNumber
Enabled
extensionName
Fax
GivenName
HomeDirectory
HomedirRequired
HomeDrive
homeMDB
homeMTA
HomePage
HomePhone
Initials
instanceType
ipPhone
isDeleted
LastBadPasswordAttempt
LastKnownParent
lastLogon
LastLogonDate
lastLogonTimestamp
legacyExchangeDN
LockedOut
logonCount
LogonWorkstations
mailNickname
Manager
mDBUseDefaults
MemberOfMNSLogonAccount
MobilePhone
Modified
modifyTimeStamp
msDS-User-Account-Control-Computed
msExchALObjectVersion
msExchHomeServerName
msExchMailboxGuid
msExchMailboxSecurityDescriptormsExchMobileMailboxFlags
msExchPoliciesExcluded
msExchRBACPolicyLinkmsExchRecipientDisplayType
msExchRecipientTypeDetails
msExchSafeSendersHash
msExchTextMessagingState
msExchUserAccountControl
msExchUserCulture
msExchVersion
msExchWhenMailboxCreated
msSBSComputerUserAccessOverride
msSBSCreationState
msSBSRoleGuid
msTSExpireDate
msTSLicenseVersion
msTSManagingLS
Name
nTSecurityDescriptorObjectCategoryObjectClass
ObjectGUID
objectSidOffice
OfficePhone
Organization
OtherName
PasswordExpired
PasswordLastSet
PasswordNeverExpires
PasswordNotRequired
POBox
PostalCode
PrimaryGroupprimaryGroupID
ProfilePath
ProtectedFromAccidentalDeletion
protocolSettings
proxyAddressespublicDelegatesBLpwdLastSet
SamAccountName
sAMAccountType
ScriptPath
sDRightsEffective
ServicePrincipalNames
showInAddressBookSIDSIDHistory
SmartcardLogonRequired
sn
State
StreetAddress
Surname
textEncodedORAddressTitle
TrustedForDelegation
TrustedToAuthForDelegation
UseDESKeyOnly
userAccountControl
userCertificate
Friday, May 30, 2014
Office 2013 Administrative Templates
If you don’t already use a Central Store and ADMX files for managing Group Policy, installing and configuring the Office 2013 ADMX files in a Central Store will prevent you from being able to manage the default Admin Templates, like System, Control Panel, etc. You will also need to install the Server 2008 R2 Administrative Templates as well to restore this functionality. These can be downloaded from here: https://www.microsoft.com/en-us/download/details.aspx?id=6243.
Follow the instructions from here to install
Download the Office AMDX templates from: https://www.microsoft.com/en-us/download/details.aspx?id=35554
The architecture doesn’t matter, as the ADMX files and ADML files are identical.
Extract the relevant file to a temporary location.
Create a folder in %SYSTEMROOT%\sysvol\domain\policies called policydefinitions
Copy the ADMX files from the temporary location to the policydefinitions folder
Copy the language folders (containing the ADML resource files) of the languages you wish to use from the temporary location to the policydefinitions folder
Open Group Policy Management. Create a new policy object. Under both Computer Configuration and User Configuration, the Office 2013 Administrative Templates are now available.
The above process and additionally be used for any ADMX templates.
References: http://technet.microsoft.com/en-us/library/02633470-396c-4e34-971a-0c5b090dc4fd
Thursday, May 22, 2014
Install Server 2008 R2 Administrative Templates (use ADMX files)
To install the Server 2008 R2 / Windows 7 Administrative Templates, download them from: https://www.microsoft.com/en-us/download/details.aspx?id=6243
On the server, open the %systemroot%\sysvol\domain\polices folder.
If the PolicyDefinitions folder doesn’t exist, create it.
Install the Server 2008 R2 / Windows 7 Administrative Templates to either a workstation or the server.
Once installed, navigate to the location you installed them to (default c:\program files (x86)\Microsoft Group Policy\win72008r2\).
Open the PolicyDefinitions folder.
Copy the ADMX files to the %SYSTEMROOT%\sysvol\domain\policies\PolicyDefinitions folder
Copy the language folders (containing the ADML resource files) of the languages you wish to use to the %SYSTEMROOT%\sysvol\domain\policies\PolicyDefinitions folder
Wednesday, May 14, 2014
Get File Version using Powershell
Trying to get the file version of an .EXE file using Powershell, I found the following interesting commands.
This will get the file version of an individual file:
(Get-Command %FILEPATH%).FileVersionInfo
Where %FILEPATH% is the path to a file
eg:
(Get-Command “C:\Program Files\Internet Explorer\IExplore.exe”).FileVersionInfo
This will get a list of files in a directory. (You can also add –recurse to the Get-ChildItem cmdlet to search subdirectories as well)
Get-ChildItem %FILEEXT% | ForEach-Object{Get-Command $_.FullName} | Select –Expand File*
Where %FILEEXT% is the file extension you wish to list.
eg:
Get-ChildItem “C:\Program Files\Internet Explorer\*.exe” | ForEach-Object(Get-Command $_.FullName} | Select –Expand File*
Using the first method, if you pipe the results to Get-Member instead of looking at the FileVersionInfo property, you can see there are also a number of other properties available:
CommandType; Definition; Extension; Module; ModuleName; Name; OutputType; Parameters; ParameterSets; Path; RemotingCapability; Visibility; FileVersionInfo; HelpUri
Reference:
http://stackoverflow.com/questions/30686/get-file-version-in-powershell
Wednesday, May 7, 2014
Canon ImageRunner Universal Send Error Codes
Wednesday, April 16, 2014
Sorting mp3 files based on Album ID3 Tags in Powershell
Taglib-sharp.dll can be found here (new window).
The powershell code at pastebin here (new window).
You will need to edit the variables:
#folderToSearch is the folder that has the files
#taglibLocation is the location of the taglib-sharp.dll
#fileExtension is the file extension of the files with the ID3 tags (eg: mp3, wma, etc)
It can also be used with WMA files, and possibly any files that contain album ID3 tags, and with a little modification, any ID3 tag can be used.
Friday, March 21, 2014
Uninstalling Trusteer Rapport
If your computer does not load at all (you cannot reach Windows) or if your keyboard has malfunctioned so that you cannot log into Windows, you must restart your computer and go into safe mode.
To do this, please follow the instructions below:
1) Restart your PC
2) Start tapping the F8 key. The Windows Advanced Options Menu appears
3) Ensure that the Safe Mode option is selected
4) Press Enter. The computer then begins to start in Safe Mode.
5) When Windows has finished loading, open the "Run" command by clicking Start and choosing "run", or type "run" in the search field
6) In the Run command window, type C:\program Files . Click OK.
7) Delete the "Trusteer" folder in the window that opens up (if exists)
8) Open the Run command again
9) Type C:\Windows\system32\drivers . Click OK.
10) Delete "RapportKELL.sys"
(On 64-bit Operating Systems, you will not find this file, it will be deleted on step 7)
11) Open the Run command again and type:
Windows XP users: %userprofile%\Local settings\application data
Vista/Windows 7 users: %userprofile%\appdata\local
12) Click OK.
13) Delete the "Trusteer" folder in the window that opens up (if exists)
14) Open the Run command again and type:
Windows XP users: %allusersprofile%\application data
Vista/Windows 7 users: %programdata%
15) Click OK.
16) Delete the "Trusteer" folder in the window that opens up (if exists)
17) Restart the PC normally