Active Directory Service Interfaces (ADSI) is a set of COM interfaces used to access the features of directory services from different network providers. ADSI is used in a distributed computing environment to present a single set of directory service interfaces for managing network resources. Administrators and developers can use ADSI services to enumerate and manage the resources in a directory service, no matter which network environment contains the resource.
ADSI enables common administrative tasks, such as adding new users, managing printers, and locating resources in a distributed computing environment.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa772170(v=vs.85).aspx
Active Directory Service Interfaces Reference
http://msdn.microsoft.com/en-us/library/windows/desktop/aa772218(v=vs.85).aspx
=============================================================
We can use System Providers in ADSI to create object and remotely manage Active Directory. ADSI includes the service providers listed in this page:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa772235(v=vs.85).aspx
Example:
For ADSI WinNT Provider
We can use Set objUser = GetObject("WinNT://"& strDomain &"/" & strUser) to create an IADsUser object and access the IADsUser object properties.
This page has all the objects of WINNT provider
http://msdn.microsoft.com/en-us/library/windows/desktop/aa772211(v=vs.85).aspx
IADsUser is one of the WINNT objects. This page has the interface of IADsUser, including methods and properties.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa746340(v=vs.85).aspx
This method can set user password: objUser.SetPassword strPassword
Thursday, July 25, 2013
Tuesday, July 23, 2013
Remotely access Exchange 2010 with PowerShell Script
Remotely check Exchange 2010 mailbox size
'Run these two commands in PowerShell first to remotely connect to exchange server from local PowerShell
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://(server name)/PowerShell/ -Authentication Kerberos
Import-PSSession $Session
'Do query
'Get one user mailbox size, can also get subfolder size by changing -folder value
Get-MailboxStatistics -Identity UserName | select -Property TotalItemSize
'This can also give the mailbox size
Get-MailboxFolderStatistics -Identity UserName -folderscope all | select -Property FolderAndSubfolderSize -first 1
'Get mailboxe size for all mailboxes
Get-MailboxStatistics -server myExchangeServerName | select Displayname,TotalItemSize | Sort-Object Displayname
'Export result to Excel file
Get-MailboxStatistics -server myExchangeServerName | select Displayname,TotalItemSize | Sort-Object Displayname | Export-CSV c:\temp\inboxsizes.csv
'View all quotas assigned to a mailbox
Get-Mailbox UserName | Format-List *Quota
'export result to Excel file
Get-MailboxStatistics -server mfl67207 | select Displayname,TotalItemSize | Sort-Object Displayname | Export-CSV c:\temp\inboxsizes.csv
'View all quotas assigned to a mailbox
Get-Mailbox <Identity> | Format-List *Quota
'Exporting Message Tracking Logs to .CSV
Get-MessageTrackingLog -Server <Server name> -Start "01/01/13 00:00:00" -End "12/12/13 23:59:59" -Recipient "TheMole@BadGuyCompany.com" -Resultsize unlimited| select sender, recipient, timestamp, messagesubject, totalbytes | export-csv c:\temp\messlog.csv
'Check inbox rule
Get-InboxRule –Mailbox <username> | fl > \temp\outlookClientRules.txt
'Disable a users Outlook Rules
Disable-Inboxrule –Mailbox <Bob Smith> -Identity “<TheOutlookRule>”
'To delete a specific users Outlook Rules
Remove-Inboxrule –Mailbox <Bob Smith> -Identity “<TheOutlookRule>”
'This is a link for Powershell command Get-mailboxstatistics
http://technet.microsoft.com/en-us/library/bb124612(v=exchg.150).aspx
'I found the above command from this page:
http://help.outlook.com/en-us/140/Gg576861.aspx
'This is Microsoft page about Powershell cmdlet
https://technet.microsoft.com/en-us/library/bb123981(v=exchg.160).aspx
'Run these two commands in PowerShell first to remotely connect to exchange server from local PowerShell
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://(server name)/PowerShell/ -Authentication Kerberos
Import-PSSession $Session
'Do query
'Get one user mailbox size, can also get subfolder size by changing -folder value
Get-MailboxStatistics -Identity UserName | select -Property TotalItemSize
'This can also give the mailbox size
Get-MailboxFolderStatistics -Identity UserName -folderscope all | select -Property FolderAndSubfolderSize -first 1
'Get mailboxe size for all mailboxes
Get-MailboxStatistics -server myExchangeServerName | select Displayname,TotalItemSize | Sort-Object Displayname
'Export result to Excel file
Get-MailboxStatistics -server myExchangeServerName | select Displayname,TotalItemSize | Sort-Object Displayname | Export-CSV c:\temp\inboxsizes.csv
'View all quotas assigned to a mailbox
Get-Mailbox UserName | Format-List *Quota
'export result to Excel file
Get-MailboxStatistics -server mfl67207 | select Displayname,TotalItemSize | Sort-Object Displayname | Export-CSV c:\temp\inboxsizes.csv
'View all quotas assigned to a mailbox
Get-Mailbox <Identity> | Format-List *Quota
'Exporting Message Tracking Logs to .CSV
Get-MessageTrackingLog -Server <Server name> -Start "01/01/13 00:00:00" -End "12/12/13 23:59:59" -Recipient "TheMole@BadGuyCompany.com" -Resultsize unlimited| select sender, recipient, timestamp, messagesubject, totalbytes | export-csv c:\temp\messlog.csv
'Check inbox rule
Get-InboxRule –Mailbox <username> | fl > \temp\outlookClientRules.txt
'Disable a users Outlook Rules
Disable-Inboxrule –Mailbox <Bob Smith> -Identity “<TheOutlookRule>”
'To delete a specific users Outlook Rules
Remove-Inboxrule –Mailbox <Bob Smith> -Identity “<TheOutlookRule>”
'This is a link for Powershell command Get-mailboxstatistics
http://technet.microsoft.com/en-us/library/bb124612(v=exchg.150).aspx
'I found the above command from this page:
http://help.outlook.com/en-us/140/Gg576861.aspx
'This is Microsoft page about Powershell cmdlet
https://technet.microsoft.com/en-us/library/bb123981(v=exchg.160).aspx
Subscribe to:
Comments (Atom)