Archive for the ‘PowerShell’ Category

Delete Files Remotely Using PowerShell Script

powershell1
To run this with out reading a list just remove the commands at the the bottom and replace the “$_” with computer name or replace the $file variable with local path. Admin rights on the remote computers will be needed and proper permission to access and delete the files. Computers.txt should have only one computer name perline. 123456789101112131415#MAIN function delete-remotefile {     PROCESS {                 $file = "\\$_\c$\File_to_be_deleted.txt"...

Query Scheduled Tasks using Powershell

powershell1
This is a slightly modified version of Aaron Dodd’s script. There are some known issues with this script and has not been tested in many environments. To use this powershell script place the script, the config file, and a list as a cvs file with the servers to be queried all in the same directory. Save below as QueryScheduledTasks.ps1: 1234567891011121314151617181920212223242526272829303132$Description="Generate CSV of scheduled tasks in the environment" #------------------------------------------------------------------------------ #...

Exchange 2007- Who’s logged in to what mailbox… when?

powershell1
One thing I missed about Exchange 2003 was being able to easily go into the mmc and view the user and logon/logoff for every mailbox. Get-MailboxStatistics | format-table DisplayName,LastLogoffTime,LastLogonTime,LastLoggedonUserAccount

Exchange 2007- Public Folder Permissions Example

powershell
Seeing that Microsoft is attemping to move away from public folders and stopped providing easy GUI managment tools I found that this is the easiest way to modify permissions for a nested PF and change all child objects. Its simple and it works… 1Get-PublicFolder -Identity "\(folder)\(folder)\" -recurse | Add-PublicFolderClientPermission -AccessRights owner (our desrired permission)

Export List of Exchange 2007 mailbox sizes – Powershell script

I have this script set as a sceduled task and runs daily on my companies Exchange 2007 servers. It helps to see not only the current sizes but to see if any mailboxes are getting out of control.   12345678910111213141516171819202122232425############################################################## # Creates a file with all exchange 2007 mailboxes and sort by size # # # # Command, scheduled task or shortct (all one line of course) # C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe -PSConsoleFile...
Twitter Delicious Facebook Digg Stumbleupon Favorites More
327 queries in 3.155 seconds.