Reply To: Retrieve the file name from path based on time stamp
You need to do some datetime arithmetic so that you can work with timespans. Something like this should do the trick: $targetTime = Get-Date -Date ’2013-07-13 12:20:11′ Get-ChildItem -Recurse -File |...
View ArticleReply To: Upper lower case sensitivity in filenames
And I truly showed my nub status with this question. – SOLVED – The bold part is all I needed. $process = invoke-expression -command “$FTP -pw $lpw $UName@$Appserver.unix.medcity.net:$paths...
View ArticleVariable Questions
Here is my code: [xml]$a = get-content c:\file.xml Using the above code, I can now select specific parts of that xml file. I do this as follows: $a.books.author.name That gives me a list of...
View ArticleReply To: Variable Questions
Looks like I had to walk away from the computer and come back to it. So for anyone else that might be having an encounter with the brain lapse, here is the code. [xml]=$a get-content c:\file.xml...
View ArticleStatus: Summit North America
The PowerShell Summit North America 2014 is scheduled. Please visit the “Summit” link, at the top of this page, for more information as it becomes available. If you have questions, please post a NEW...
View ArticleStatus: Summit Europe
The PowerShell Summit Europe 2014 is currently in planning, with a target date of Fall 2014. We are strongly aiming for September, but much will depend on venue availability. We are presently polling...
View ArticleChanging User properties
I have a script that creates a user and assigns the password and the user to a group but I need to get 2 check boxes ticked – ‘User cannot change password’ and ‘Password never expires’ but for the...
View ArticleReply To: Changing User properties
This blog post should have you covered: http://www.hofferle.com/modify-local-user-account-flags-with-powershell/ If not, after reviewing that post come back with more questions. Thanks, Kirk out.
View ArticleReply To: Changing User properties
Many thanks for your response – I figure it out earlier this morning with the following:- $objUser.UserFlags = 64 + 65536 # ADS_UF_PASSWD_CANT_CHANGE + ADS_UF_DONT_EXPIRE_PASSWD
View ArticleReply To: Active Directory 'Pager' field
OK, just to follow on from that, I’ve exported a list of users whose ‘Pager’ field is empty. I’ve done a vlookup against a master spreadsheet to get the correct pager numbers for each user and ended...
View ArticleAD location address field population question
I’m working on a script to make sure certain user information is always correct in AD compared to an external employee database. The one section I’m struggling on to make efficient is making sure each...
View ArticleReply To: AD location address field population question
EmployeeID is a parameter for Set-ADUser. To set the employee ID, you simply need to invoke Set-ADUser $ADProperties.SamAccountName -EmployeeID someValue. If you want to set an attribute based on...
View ArticleReply To: AD location address field population question
I mistakenly copied the wrong section in the original post and I can’t seem to edit it. Anyway, after posting it and playing with it some more figured out how to correctly use the replace parameter of...
View ArticleSetting Active Directory OU '-Path' parameter
Evening All, Quick one… I’m trying to write a script to help with user AD account creation. (Import-CSV and New-ADUser) One of the CSV file headers is ‘Area Number’. The column’s cell contents will...
View ArticleReply To: Setting Active Directory OU '-Path' parameter
Either of these should work Import-Csv area.csv | foreach { ‘ou=Area’ + $_.”Area Number” +’,ou=suppliers,ou=Europe,dc=company,dc=com’ “ou=Area$($_.’Area...
View ArticleReply To: Setting Active Directory OU '-Path' parameter
I tried them both. The 2nd one worked. Many thanks for your help, Richard. Much appreciated!
View ArticleOk, convert this!
I’m pulling data out of an XML file. One of those fields is a date. I reference this with something like $a.b.c.date. The date looks like this when extracted: Jul 16 16:08:30 +00:00 Get-Date hates...
View ArticleReply To: Ok, convert this!
This should give you a push in the right direction: PS C:\> $month,$day,$hour,$minute,$second,$timezone = ‘Jul 16 16:08:30 +00:00′ -split ‘[: ]‘,6 PS C:\> $month Jul PS C:\> $day 16 PS...
View ArticleReply To: Ok, convert this!
Poshoholic, After I asked the question I started playing around with string manipulation. This is what I ran: $date = $date.Substring(0,16) That produced the following string: Jul 15 16:08:30 It’s...
View ArticleReply To: Ok, convert this!
The method I shared yesterday is a little different than what you were doing, because I pulled out the individual pieces so that you could do something with them (like pass them in as parameters to...
View Article