| Topic |
 |
RE: How to create users across multiple dbs from file. You need to use ConvertTo-SecureString, look at the below example: $password = (ConvertTo-SecureString ("Password"+$_) -asplaintext -force) So the script block will look like this: [code] 660..670 | Foreach-Object ` { If($StrUsersPerDat ... by get-james in Exchange Server on 21 Jul 2011 01:31 PM
|
 |
RE: How to create users across multiple dbs from file. Hi,I would take a different approach and instead of putting users on each database in groups of 10, I would randomaly put the users accross all DB's until each DB has a certain amount of users in them. This way, there is no pattern of where each gr ... by get-james in Exchange Server on 21 Jul 2011 12:13 AM
|
 |
RE: 2003 edb and stm file size. Hi Rob, One way of doing it, would be to add a where-object statement when it searches AD. Depending on which version of Powershell you are using, you can add the below commands to add a parameter and a where-object statement: PS1.0Param([stri ... by get-james in Exchange Server on 19 Jul 2011 11:52 PM
|
 |
RE: 2003 edb and stm file size. The data returned looks like below: PS C:\> iCheck-GetExchangeRAWDBSizes | Format-Table -AutoSize Server Database Name Type EDB FileSize(GB) STM FileSize(GB) Combined FileSize(GB) ------ ------------- ---- -------- ... by get-james in Exchange Server on 19 Jul 2011 11:11 AM
|
 |
RE: 2003 edb and stm file size. Rob, I have created the below function which extracts the information you require for Exchange 2003: Cheers James [code] Function iCheck-GetExchangeRAWDBSizes { #Get Exchange StorageGroup info from AD $objRootDSE = [ ... by get-james in Exchange Server on 19 Jul 2011 07:53 AM
|
 |
RE: Extract lastlogon AD attrib from each DC on domain and select Inactive Accounts that have not logged on for 30 days Also, if you only want to check the results for one user, just run the following commands: #Single user test: $StrAllResults | Where {$_.Properties.samaccountname -eq "User01"} | Foreach-object ` { ... by get-james in Peer Review on 31 Jan 2011 03:56 AM
|
 |
Extract lastlogon AD attrib from each DC on domain and select Inactive Accounts that have not logged on for 30 days All,I have created the following PS script which extracts the following AD attribs from each DC, so you can select inactive accounts:samaccountname,lastlogon,pwdlastset,lastlogontimestampI have tested this on PS2.0 agaist Win2003 & Win2008R2 DCs.If ... by get-james in Peer Review on 30 Jan 2011 02:09 AM
|
 |
RE: Search each DC one at a time using - System.DirectoryServices.DirectorySearcher Sorted it now: $StrDCs = [System.DirectoryServices.ActiveDirectory.Domain]::getcurrentdomain() | foreach{$_.DomainControllers | foreach{$_.Name}} $lastLogonIntervalLimit = ((date).ToUniversalTime()).AddDays(-30).ToFileTime() $StrD ... by get-james in General PowerShell on 28 Jan 2011 05:32 AM
|
 |
[Resolved] Search each DC one at a time using - System.DirectoryServices.DirectorySearcher Hi,I am querying AD using the following System.DirectoryServices.DirectorySearcher, but need to be able to search each of my DCs.$lastLogonIntervalLimit = ((date).ToUniversalTime()).AddDays(-30).ToFileTime() $strFilter = "(&(objectCategory=person)(o ... by get-james in General PowerShell on 28 Jan 2011 05:35 AM
|
 |
RE: PS2.0: Help with Start-Job using Advanced Functions. Looking at this URL: http://social.technet.microsoft.com/Search/en-US/?query=start-job%20running&rq=meta:Search.MSForums.ForumID(c357631a-5a8a-409c-b4ec-1423973b6f28)+site:microsoft.com&rn=Windows+PowerShell+Forum This works: Start-Job -Scri ... by get-james in General PowerShell on 22 Nov 2010 09:59 AM
|
 |
RE: PS2.0: Help with Start-Job using Advanced Functions. Another question. When i run this command on an XP SP3 machine pointing at Server 2003 servers, the job hangs at the "Running" state: State : Running HasMoreData : True StatusMessage : Location : localhost Command : ... by get-james in General PowerShell on 22 Nov 2010 09:14 AM
|
 |
RE: PS2.0: Help with Start-Job using Advanced Functions. All, Managed to find another way, using Splatting and using -initializationScript: $StrParams = @{ name = "GetDiskInfo"; initializationScript = { Function GetRes($ComputerName) { #Using Splatting to combine ... by get-james in General PowerShell on 21 Nov 2010 11:50 PM
|
 |
PS2.0: Help with Start-Job using Advanced Functions. Hi,I have recently upgrade to version 2.0 of powershell and am trying to take advantage of the background jobs to increase the performance of my scripts.I have manage to figure out of to get a background job working with a function, by using splatti ... by get-james in General PowerShell on 20 Nov 2010 03:19 AM
|
 |
RE: Help extracting exchange mailbox creation date (PR_Creation_Date) using Powershell v1.0 using COM object Outlook.Application I have found out, that this can't be done, due to the 'logon' method which is unvailable when using the -com object 'mapi.session' using powershell. I have done it in vbscript. Cheers James by get-james in General PowerShell on 16 Dec 2009 01:56 AM
|
 |
Help extracting exchange mailbox creation date (PR_Creation_Date) using Powershell v1.0 using COM object Outlook.Application Hi, I have found the following VBscript example of what I would like todo in Powershell, but am having difficulty trying to convert it? I need to get a list of created mailbox dates so I can do some reporting. The below URL, has the following vbscri ... by get-james in General PowerShell on 14 Dec 2009 02:11 AM
|
 |
RE: Help with regex expression? Thanks both very much for your help... The following parameter from Glenn, does the job: $a -match "^ABC\s|\sABC\s|(\(ABC\s)|(\sABC\))" I am learning new things every day :-) Cheers again. James by get-james in General PowerShell on 22 Apr 2009 06:15 AM
|
 |
RE: Help with regex expression? Cheers Guys, Nearly there... It is now not matching some display names like "ABC Memebers": $a = "Brown, James (ABC Team)","Levy, Shay (Powershell dude - Team ABC)","Unknown, Glenn (Team PS)","ABCDen, Pete (Unix Team)","Black, Jane (Z&ABC ... by get-james in General PowerShell on 22 Apr 2009 04:02 AM
|
 |
RE: Help with regex expression? $a = "Brown, James (ABC Team)","Levy, Shay (Powershell dude - Team ABC)","Unknown, Glenn (Team PS)","ABCDen, Pete (Unix Team)","Black, Jane (Z&ABC Team)","Smith, Matt (North ABC)","Yellow, Nigel (South ABC)" $a | where {$_ -match "\s.(abc)\s"} ... by get-james in General PowerShell on 22 Apr 2009 03:53 AM
|
 |
RE: Help with regex expression? Glenn, Just to give you some more information, I have a large CSV file, with loads of user displaynames in it. For example: Brown, James (ABC Team) Levy, Shay (Powershell dude - Team ABC) Unknown, Glenn (Team PS) ABCDen, Pete (Unix Team) Black, Jane ... by get-james in General PowerShell on 22 Apr 2009 03:42 AM
|
 |
RE: Help with regex expression? Shay, I think I might have done it with the following: PS C:\> $a | where {$_ -match "\s.(ABC)\s"} User 01 (ABC Team) by get-james in General PowerShell on 22 Apr 2009 03:29 AM
|
 |
RE: Help with regex expression? Cheers Shay, What if I only want to match "ABC" on its own? by get-james in General PowerShell on 22 Apr 2009 03:22 AM
|
 |
Help with regex expression? Hi Guys,Need a little help with regex expressions, I am trying to only select one item from a collection, using the example below, I would only like to match "User 01 (ABC Team)": $a = 'User 01 (ABC Team)','User 01 (ABCDE Team)','ABCUser 01 (XYZ Te ... by get-james in General PowerShell on 22 Apr 2009 02:53 AM
|
 |
RE: Convertto-html - different colors per row/line Cheers, Looks like I will have to do that then... Shame, as it means i will now need to rewrite some of my daily check PS scripts. Thanks anyway. James by get-james in General PowerShell on 20 Mar 2009 02:07 PM
|
 |
Convertto-html - different colors per row/line Hi, Does anybody know how to create an HTML file with different colors per row? The following PS code, creates a HTML will the all the results shown in a table: ############################################### $a = "" $a = $a + "BODY{background-color ... by get-james in General PowerShell on 20 Mar 2009 03:51 AM
|
 |
RE: Retrieving Data From a Comma Delimeted Text File If you have loads of file that you need to add the headers to, you can use the below commands, depending on the file size: #### For small files ####"User,Date,Time,DC,IP", (get-Content C:\temp\Test.txt) | Set-Content C:\temp\Test.txt #### For bi ... by get-james in General PowerShell on 20 Feb 2009 07:25 AM
|
 |
RE: Sending email using New-Object -comObject Outlook.Application? Thanks Glen, That works great, i will remember that for next time. Cheers James by get-james in General PowerShell on 22 Jan 2009 11:15 PM
|
 |
Sending email using New-Object -comObject Outlook.Application? Hi Guys,I am trying to send an plain text email using the com object Outlook.Application using Outlook 2003, which works, but I have having trouble trying to get the body of the message to format correctly?I have a plain text file with the following ... by get-james in General PowerShell on 22 Jan 2009 02:09 PM
|
 |
RE: Group/Subtotals for a collection of items? Thanks Shay for your quick response, just what I was looking for. Cheers James by get-james in General PowerShell on 20 Jan 2009 03:14 AM
|
 |
Group/Subtotals for a collection of items? Hi, I am importing a .csv file into PowerShell and trying to group/subtotal by one field. Example of data: User Group ---- ----- User01 Group01 User02 Group01 User03 Group01 User04 Group02 User05 Group04 User06 Group03 User07 Group05 ... by get-james in General PowerShell on 20 Jan 2009 02:49 AM
|
 |
RE: Viewing log file Have you tried selecting only the properties you are interested in like: $Server="." $logfile="Application" $recent=[System.Management.ManagementDateTimeConverter]::ToDMTFDateTime((Get-Date).AddDays(-1)) # Gets yesterdays date. $Events = get ... by get-james in General PowerShell on 14 Jan 2009 06:55 AM
|