Start by creating a list of computers that need the command run on them (pclist.txt.). Use the file copy command for /f %a in (pclist.txt) do copy /y \\server\share\file.bat \\%a\c$\ to copy the files to the machines in the pclist.txt. In this example the file is copied to the root. Next, from an elevated command prompt run:
psexec @pclist.txt c:\file.bat
This will execute the batch or exe file you copied to the remote machine on the remote machine.
If you need to authenticate run:
psexec @pclist.txt -u domain\user c:\file.bat and it will prompt for a password.
Friday, December 27, 2013
copy files to multiple remote computers
To copy a file to multiple computers first create a txt file with all the computer names in it. Place the file you want to copy in an accessible location for all the machines. Run the following command:
for /f %a in (pclist.txt) do copy /y \\server\share\file.txt \\%a\c$\
This "should" copy the file to the machines listed assuming you have remote access.
for /f %a in (pclist.txt) do copy /y \\server\share\file.txt \\%a\c$\
This "should" copy the file to the machines listed assuming you have remote access.
Thursday, December 19, 2013
Exchange dynamic distribution groups based on security groups.
To create an exchange dynamic distribution group based on security group this can be done through powershell. The command specifies where to create the dynamic distribution group and what group the users will be a member of to pull the addresses from.
The group name is “Dyn_universal” the security group is dyn_test, so any user in the OU test that is a member of dyn_test will get mail sent to the distribution group.
New-DynamicDistributionGroup "Dyn_universal" -Alias "Dyn_universal" -OrganizationalUnit "OU=Test,DC=mydomain,DC=local" -RecipientFilter "MemberOfGroup -eq 'CN=dyn_test,OU=test,DC=mydomain,DC=local'"
Tuesday, November 5, 2013
Unable to send pictures from phones through exchange
With the following command you can change the value (in this case 10MB):
C:\Windows\System32\inetsrv\appcmd.exe set config -section:system.webServer/serverRuntime /uploadReadAheadSize:"10485760" /commit:apphost
C:\Windows\System32\inetsrv\appcmd.exe set config "Default Web Site" -section:system.webServer/serverRuntime /uploadReadAheadSize:"10485760" /commit:apphost
restart IISAdmin service.....
Tuesday, September 17, 2013
Remove .local from exchange web settings
1.Start the Exchange Management Shell.
2.Modify the Autodiscover URL in the Service Connection Point. The Service Connection Point is stored in the Active Directory directory service. To modify this URL, type the following command and then press ENTER:
Set-ClientAccessServer -Identity CAS_Server_Name -AutodiscoverServiceInternalUri https://mail.contoso.com/autodiscover/autodiscover.xml
3.Modify the InternalUrl attribute of the EWS. To do this, type the following command, and then press ENTER:
Set-WebServicesVirtualDirectory -Identity "CAS_Server_Name\EWS (Default Web Site)"
-InternalUrl https://mail.contoso.com/ews/exchange.asmx
4.Modify the InternalUrl attribute for Web-based Offline Address Book distribution. To do this, type the following command, and then press ENTER:
Set-OABVirtualDirectory -Identity "CAS_Server_name\oab (Default Web Site)"
-InternalUrl https://mail.contoso.com/oab
5.Open IIS Manager.
6.Expand the local computer, and then expand Application Pools.
7.Right-click MSExchangeAutodiscoverAppPool, and then click Recycle.
Wednesday, August 28, 2013
Exchange 2010 bug not removing mailboxes after migration to an new database
While moving mailboxes from one database to another the move request finishes with a warning:
Warning: Failed to clean up the source mailbox after the move.
Error details: MapiExceptionUnexpectedMailboxState: Unable to delete mailbox. (hr=0x80004005, ec=2634)
You will see the mailbox is disconnected but won't delete. To remove the mailbox use exchange powershell and enter these commands:
$aa=Get-MailboxStatistics -Database Mailbox database name| where {$_.DisconnectReason -eq “SoftDeleted”}
$aa | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}
Wednesday, August 14, 2013
Limit Exchange 2010 memory use
ADSIedit.msc
Select known naming context and pick Configuration
Configuration-Services-MS Exchange-ORG NAME-Admin groups-ADMIN GROUP-Servers-SERVERNAME-Info Store
Right click the info store and choose properties and scroll down to find msExchESEParamCacheSizeMax and msExchESEParamCacheSizeMin
1GB is 32768, multiply that by the number of GB you want for min and max. Example
4GB min 32768
8GB max 262144
This is different than exchange 2007
1gb is 131072
Friday, August 9, 2013
Enabe mailbox auditing Exchange 2010
Set-Mailbox -Identity User2 -AuditEnabled $true
Then configure what you want to audit:
Set-Mailbox -Identity user2 -AuditAdmin copy,MoveToDeletedItems,move,update,folderbind,messagebind -AuditOwner Update,Move,MoveToDeletedItems,SoftDelete,HardDelete -AuditDelegate Update,MoveToDeletedItems,SoftDelete,HardDelete,SendAs,Create -AuditEnabled $true
Then use exchange control panel to search the logs:
https://yourmail.server.com/ecp
Friday, May 31, 2013
Change please wait to a usable message for Windows 7/Vista boxes
Computer Configuration | Administrative Templates | System | "Verbose vs normal status messages". Change state to "Enabled"
Wednesday, May 15, 2013
Import PST into exchange 2010
New-ManagementRoleAssignment –Role "Mailbox Import Export" –User USER
The files need to be stored on a share
New-MailboxImportRequest -FilePath \\server\share\user.pst -Mailbox usermailbox
Command to remove request when completed:
Get-MailboxImportRequest | where {$_.status -eq "Completed"} | Remove-MailboxImportRequest
Monday, April 29, 2013
Exchange backpressure fix:
Modify the edgetransport.exe.config file
c:\program files\microsoft\exchange server\bin (Exchange 2007) or c:\program files\microsoft\exchange server\v14\bin (Exchange 2010)
Search for and change the "EnableResourceMonitoring" from “True” to "False", save and close the file, then restart the Microsoft Exchange Transport Service.
Monday, April 15, 2013
EZ exchange 2007 cert for SBS
First make sure web enrollment role is installed. It will require a reboot if it is not.
Navigate to https://localhost/certsrv and click past the warning, if you get the funky this site doesn't exist message you need to open IIS and stop the SBS Web Applications site and restart the default site. That should allow the site to open. From there we need to create the new cert request in powershell. The easiest way is to go to: https://www.digicert.com/easy-csr/exchange2007.htm and enter your cert information. The common name is mail or remote and your domain name. Other names should be autodiscover.domain.com, autodiscover.internaldomain, servername.interndomain. Enter those into the neat boxes and copy the newly created script.
Paste the script into exchange powershell, from there it will kick out the request to the c: drive. Open the request in notepad, and open the cert enrollment webpage. Your going to submit an advanced request, in the second screen select the second option, this is the base 64-bit request.
Once you do the request make sure you select web server as the cert type.
You will then download the cert.
Back in powershell run: Import-ExchangeCertificate -Path c:\cert.cer or whatever you saved the file as.
It will kick out the thumbprint, you will need that in the next step.
Run: Enable-ExchangeCertificate -Services "SMTP,POP,IMAP,IIS"
It will ask for the thumbprint, copy and paste this. Select A for all and your done!
Friday, April 12, 2013
Find mailbox size for exchange 2010
Get-MailboxStatistics -Database "Mailbox Database xxxx" | Select DisplayName, ItemCount, TotalItemSize | Sort-Object TotalItemSize -Descending | Export-CSV C:\MBSizes.csv
Thursday, April 4, 2013
Export email from exchange 2010
Grant a user rights to perform a mailbox export, by default no one has this:
New-ManagementRoleAssignment –Role "Mailbox Import Export" –User Administrator
Create a network share to dump the exported mail to. This must be a network share as the command requires the file to be dumped to a unc.
Command to export mail:
New-MailboxExportRequest -Mailbox mailbox -FilePath \\server\share\file.pst
View progress:
Get-MailboxExportRequest
Once it is complete you need to clear the request:
Get-MailboxExportRequest | where {$_.status -eq "Completed"}
Tuesday, April 2, 2013
Tool to query AD
Numerous built in queries for cmoputers, contacts, users and groups. Download the free version or buy the version with more features:
http://www.cjwdev.co.uk/Software/ADReportingTool/Info.html
Free version lets you export to csv.
Edit host file via command line
echo 0.0.0.0 websitename.com >> %SYSTEMDRIVE%\Windows\System32\Drivers\Etc\Hosts
Wednesday, February 27, 2013
List users in an active directory group
dsquery group domainroot -name groupname | dsget group -members | dsget user -fn -ln >output.csv
This will dump a list of users in the "groupname" you have entered.
Wednesday, January 16, 2013
Exchange anonymous Relay
Exchange 2007/10 needs a new receice connector created, leave the local network set to default, change remote servers to be just the IP of the device you want to be able to relay. After the connector is created, edit it, remove all checks from authentication boxes, add a check to anonymous on the permission group. Open powershell and run:
Get-ReceiveConnector “Anonymous Relay” | Add-ADPermission –User “NT AUTHORITY\ANONYMOUS LOGON” –ExtendedRights “Ms-Exch-SMTP-Accept-Any-Recipient”
This assumes you named the relay "anonymous relay"
Subscribe to:
Posts (Atom)