Monday, December 10, 2012
Disable Windows 7 Firewall by command line
Domain Profile:
Netsh advfirewall set domainprofile state off
Private Profile:
Netsh advfirewall set privateprofile state off
Public Profile:
Netsh advfirewall set publicprofile state off
Or to disable all:
Netsh advfirewall set all state off
Show profile status:
Netsh advfirewall show allprofiles
Wednesday, July 25, 2012
Windows Firewall tips
You can't stop the service for Windows 7, you can however from a command line stop the firewall portion of the service. From a command line run: netsh advfirewall set allprofiles state off
For Windows XP run:
net stop SharedAccess
and edit the registry key to stop the service from running:
HKLM\System\CurrentControlSet\Services\SharedAccess change start to 4.
Monday, July 16, 2012
Import email PST to exchange 2010
Only works with SP1 and up!!!
Open powershell
New-ManagementRoleAssignment –Role “Mailbox Import Export” –User UserAccount
Place PST file in folder and share out, Exchange Trusted Subsystem must have read/write permissions to the folder.
Next run the import command:
New-MailboxImportRequest –Mailbox Usermailbox–FilePath \\full unc path to share\PST file name
Friday, July 13, 2012
Setup anonymous relay, exchange 2010
Open exchange manager, go to server configuration, hub transport, add new receive connector. Name it relay, in the next window remove the ip settings and add the server ip address, the next window add the devices you want to allow relay from. Once the connector is created, open the connector and choose permission groups and select anonymous. Then you need to run a command from the shell:
Get-ReceiveConnector "Relay" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "Ms-Exch-SMTP-Accept-Any-Recipient"
thats it.
Tuesday, July 10, 2012
Even easier way for a new self signed cert!
On the SBS server run MMC.EXE and add the snap-in for Certificates and for certificate templates. For the certificate console you will be asked what you will be managing the certs for, select Computer Account. In the next window select local computer.
In the MMC select cert. templates and find Web Server, right click the web server template and select properties then the security tab.
Add the local computer to the list of users permissions and select Enroll as a right.
Click on Certificates (Local Computer) and open “Personal – Certificates”
Right click on certificates and request a new cert.
Select next twice and choose web server and click on the blue words indicating more information is neeeded.
Subject name box, select common name and enter the value as : remote/mail. yourdomain .com and add it.
In the second box select DNS and enter the other names the cert should have:
domain.com
remote/mail.domain.com
internaldomain.local
autodiscover.domain.com
servername.
Select Ok and enroll.
Open IIS and go to default web site bindings, select HTTPS and Edit and select your new cert. If you not sure which cert you want to use, select it then choose view.
Tuesday, June 26, 2012
Create new self signed cet for exchange 2010
From exchange powershell:
New-ExchangeCertificate -FriendlyName "SelfSigned Cert" -SubjectName "cn=mail OR remote.domain.com" -DomainName SERVERNAME,SERVERNAME.domain.local,mail OR remote.domain.com,autodiscover.domain.com-PrivateKeyExportable $True
Chose to overwrite the existing cert.
Next enable the cert:
enable-exchangecertificate -donotrequiressl
service type: pop, imap, iis, smtp
enter the thumbprint for the new certificate.
From exchange consoole you can export the cert to be installed on machines.
Tuesday, June 12, 2012
Recover deleted exchange messages/folders
So you have a user who deleted a message or a folder from Exchange 2010 and you can't find it in the dumpster, here is how to setup a recovery database and restore the file.
First restore the database file and logs to a recovery folder. I will be restoring the files to an external drive since we do image based backups hourly, I don't need another backup of my backup file. My external drive is E and my exchange data is located at: C:\Program Files\Microsoft\Exchange Server\V14\Mailbox\Mailbox Database 2011072209
Make sure you restore the DB and all the log files, basically restore the entire folder!
From here check to see if the database is in a dirty shutdown state so from the powershell run:
eseutil /mh “E:\Recovery\mailbox database 2011072209.edb”
Notice the name of the mailbox DB, yours may be different.
After running the command look for a line that says "State: Dirty Shutdown"
If it reports this we need to check the status of the logs, again from powershell:
eseutil /ml E:\Recovery\E00
(E00 is the prefix to the log files located in the database folder)
The command should respond with "No Damaged log files were found)
If so, we can attempt to brind the database into a clean shutdown: (powershell)
eseutil /r E00 /i /l E:\Recovery\ /d 'E:\Recovery\Mailbox Database 2011072209.edb'
The first section, E:\recovery is location of the log files, the second location is the database name.
The operation will complete reletively quick, however it doesn't mean it fixed the database, so we run a command to check the status:
eseutil /mh 'E:\Recovery\mailbox database 2011072209.edb' | findstr "State:"
If you get good news and it reports "State: Clean Shutdown" great, if not, we repair!
eseutil /p 'E:\Recovery\mailbox database 2011072209.edb'
This baby will take a long time, when you thing its hung, its not! After the process completes, rerun the findstr command again:
eseutil /mh 'E:\Recovery\mailbox database 2011072209.edb' | findstr "State:"
If it reports clean, mount the recovery database!!
First, create a log folder in the subfolder of your recovery folder. Next we run a command to create the database:
New-MailboxDatabase RecoveryDB -Server Servername -Recovery:$true -EdbFilePath 'E:\Recovery\mailbox database 2011072209.edb' -LogFolderPath 'E:\Recovery\rec'
The first section we enter the exchange server name, next the database file name, lastly the location for the logfiles to go. This needs to be an empty folder and created ahead of time.
Next, mount the DB:
Mount-Database RecoveryDB
Next we can list the contents of the database to ensure our users data is there:
Get-MailboxStatistics -Database RecoveryDB
Once the database is mounted, recover the mailbox. For this example the mailbox will be recovered to the original users mailbox. It will appear as a subfolder in the root of his mailbox:
Restore-Mailbox -Identity "User Name" -RecoveryDatabase RecoveryDB -RecoveryMailbox "User Name" -TargetFolder Restore
Now, this is going to restore the users mailbox to the original user, we can however restore it to someone elses mailbox. Also for the user name quotations are not needed if there is no space in the user name. We are restoring the mail to a folder named "Restore" however this folder can be named anything you want.
Subscribe to:
Posts (Atom)