<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://powershell.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results for '(app:forums OR groupid:24)' matching tag 'Active Directory'</title><link>http://powershell.com/cs/search/SearchResults.aspx?q=(app:forums+OR+groupid:24)&amp;tag=Active+Directory&amp;orTags=0&amp;o=DateDescending</link><description>Search results for '(app:forums OR groupid:24)' matching tag 'Active Directory'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Set quota on C:\ drive for a specific group </title><link>http://powershell.com/cs/forums/thread/23249.aspx</link><pubDate>Thu, 02 May 2013 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:23249</guid><dc:creator>MyztiquL</dc:creator><description>&lt;p&gt;Hey guys,&lt;/p&gt;
&lt;p&gt;First off all, I spent a lot of time researching this on the internet and I haven&amp;#39;t found a solution yet so I decided to make an account to finally solve it.&lt;br /&gt;The situation: Windows 2008 server, I have a database filled with users, I have a script that adds certain users of a specified department to the Active Directory and creates a group and an organisational unit for those users.&amp;nbsp;&lt;br /&gt;I now want that group of users to have the same quota (specified by another inputbox) on the local C:\ drive of the local server where the script runs on.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry if my question is a little vague but is there any way this is possible using Powershell?&lt;/p&gt;</description></item><item><title>Execute adamsync from another host</title><link>http://powershell.com/cs/forums/thread/22852.aspx</link><pubDate>Wed, 17 Apr 2013 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:22852</guid><dc:creator>svizzero81</dc:creator><description>&lt;p&gt;Hi all,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How can I remotely execute adamsync command?&lt;/p&gt;
&lt;p&gt;Use the following command:&lt;/p&gt;
&lt;p&gt;Invoke-Command -ComputerName hostname -SCriptBlock {c:\Windows\ADAM\adamsync /sync hostname:389 &amp;quot;ou=people,dc=example,dc=com&amp;quot; /creds DOMAIN Administrator Password} -Credential $cred&lt;/p&gt;
&lt;p&gt;Error Logs:&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;Ldap error occured. ldap_get_next_page_s: Operations Error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Extended Info: 000004DC: LdapErr: DSID-0C0906E8, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v1db1.&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;If I run my script locally:&lt;/p&gt;
&lt;p&gt;c:\Windows\ADAM\adamsync /sync hostname:389 &amp;quot;ou=people,dc=example,dc=com&amp;quot; /creds DOMAIN Administrator Password&lt;/p&gt;
&lt;p&gt;It works correctly.&lt;/p&gt;
&lt;p&gt;BR&lt;/p&gt;
&lt;p&gt;Marco&lt;/p&gt;</description></item><item><title>Get-QADObject Memory Issues</title><link>http://powershell.com/cs/forums/thread/22586.aspx</link><pubDate>Thu, 04 Apr 2013 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:22586</guid><dc:creator>Sam_A</dc:creator><description>&lt;p&gt;Good Afternoon,&lt;/p&gt;
&lt;p class="p1"&gt;I&amp;#39;m tried looking around the web for this issue, but have not been able to find a definite solution.&lt;/p&gt;
&lt;p class="p1"&gt;QUICK OVERVIEW: My company had to change email servers. In the process we migrated just under 4,000 users to the new email system. As a transition phase during the migration a contact was created for each user with the new email address. The user account was then pointed to forward mail to this contact. I wrote a Powershell 3.0 script using the Quest AD Module to delete the contacts and update the corresponding user account with the new email information. The script works excellent on a small scale, but starts throwing &amp;quot;Out of Memory&amp;quot; errors when it gets to about 600+ users. I&amp;#39;m not sure what I&amp;#39;m missing or how to catch / fix this memory leak. Any recommendations would be greatly appreciated.&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;ATTEMPTED SOLUTIONS: The script initually did everything under 1 function: export the contacts with all attributes (my failsafe in case something went horribly wrong), found the user account that corresponds to the contact, exported user info (again failsafe), deleted contact, updated user, export the user with the new settings. After reading on the few forums I found that were relevant, I tried implementing Clear-Variable, [GC]::Collect(), Remove-Variable throughout the script, but did not see any impact on the memory usage. Under this initial script, I was using about 1.6GB of RAM about 1/3 into the script. The code for the script I&amp;#39;m posint below is version 6. In this one I&amp;#39;m Including all properties on my queries for the export purposes. In previous versions I was only selecting the properies I needed, but then had to do another Get-QADObject/User with full properties for the export. In the end, the script crashed with the &amp;quot;Out of Memory&amp;quot; error regardless of whether I was getting all properies or only the selected ones. I also played around with different PageSize settings and setting it to 25 seemed to speed the process up the most, but had no noticeable impact on the memory consumption. In one version of the script I even tried a While (contacts exist) { process accounts with SizeLimit &amp;#39;250&amp;#39;}. During the testing phase I wasn&amp;#39;t actually makeing the changes, just moving the contacts to another OU. In theory I though that setting the size limit would fix my issue, but it had no impact to the overall result.&lt;/p&gt;
&lt;p class="p1"&gt;I finally broke the script into functions and pipelined the whole process (see code below: code has been slightly modified to hide true variable values and condense comments and custom messages).&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;ERROR MESSAGES: These are the error messages I&amp;#39;m receiving. As you can see, the system has plenty of RAM available, but the script is using ~ 1.4GB. I&amp;#39;m not 100% sure what the 2nd part of the error means. I&amp;#39;m assuming that it resulted in the memory running out and the variable not containing any more data for that iteration of the script.&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;img alt="Error Message" src="http://powershell.com/cs/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.02.98.63/Full-Error-_2D00_-with-RM.PNG" /&gt;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;SCRIPT CODE:&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;#requires -version 3&lt;/p&gt;
&lt;p class="p1"&gt;## Load Quest Snappin&lt;/p&gt;
&lt;p class="p1"&gt;Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction silentlycontinue&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;## ***** Declare Variables *****&lt;/p&gt;
&lt;p class="p1"&gt;## Containers&lt;/p&gt;
&lt;p class="p1"&gt;$global:contact_OU = &amp;quot;ou=MIGRATION,ou=CONTACTS,ou=OFFICE,ou=DEPT,dc=SUBDOMAIN,dc=DOMAIN,dc=COM&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;$global:unmatched_OU = &amp;quot;ou=Unmatched,ou=MIGRATION,ou=CONTACTS,ou=OFFICE,ou=DEPT,dc=SUBDOMAIN,dc=DOMAIN,dc=COM&amp;quot;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;## Reporting Variables&lt;/p&gt;
&lt;p class="p1"&gt;$global:report_path = &amp;quot;C:\AD\Email Cleanup&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;$global:timeStamp = Get-Date -UFormat &amp;quot;%H%M_%d-%m-%d-%Y&amp;quot;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;## Get-QAD Object Splat Variables&lt;/p&gt;
&lt;p class="p1"&gt;$user_splat = @{&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; OrganizationalUnit = &amp;quot;ou=USERS,ou=DEPT,ou=COMPANY,dc=SUBDOMAIN,dc=DOMAIN,dc=COM&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; LdapFilter = &amp;quot;(!(DisplayName=*.ADM))&amp;quot; ## Do not include admin accounts&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; IncludeAllProperties = $true&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; SizeLimit = &amp;quot;1&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; ShowProgress = $true&lt;/p&gt;
&lt;p class="p1"&gt;} # end $user_splat&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;$contact_splat = @{&lt;/p&gt;
&lt;p class="p1"&gt;Type = &amp;quot;Contact&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; OrganizationalUnit = $contact_OU&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; LdapFilter = &amp;quot;(mail=*@newEmail.com)&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; IncludeAllProperties = $true&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; SearchScope = &amp;quot;OneLevel&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; SizeLimit = &amp;quot;0&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; PageSize = &amp;quot;25&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; ShowProgress = $true&lt;/p&gt;
&lt;p class="p1"&gt;} # end $contact_splat&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;## Write-Out colors.&amp;nbsp; Some color variables have been removed to shorten the code being posted.&lt;/p&gt;
&lt;p class="p1"&gt;$gc_colors = @{&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; ForegroundColor = &amp;quot;Yellow&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; BackgroundColor = &amp;quot;DarkGreen&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;} # end splat $gc_colors&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;cls&lt;/p&gt;
&lt;p class="p1"&gt;## ***** Get Reports *****&lt;/p&gt;
&lt;p class="p1"&gt;function Get_Reports ($obj, $fileName) {&lt;/p&gt;
&lt;p class="p1"&gt;## Export the objects&lt;/p&gt;
&lt;p class="p1"&gt;$report = $timeStamp + &amp;quot;_&amp;quot; + $fileName&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;$obj | Export-Csv &amp;quot;$report_path\$report.csv&amp;quot; -Append -NoTypeInformation&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;return $obj&lt;/p&gt;
&lt;p class="p1"&gt;} # end function Get_Reports&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;## ***** Update Users *****&lt;/p&gt;
&lt;p class="p1"&gt;function Process_Users ($contact) {&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; if (!($user = Get-QADUser @user_splat -LogonName $contact.mailNickname)) {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Host &amp;quot;*******************************************************&amp;quot; @unmatched_colors&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Host @unmatched_colors $contact.Name &amp;quot; Could not be matched to a user account.&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Host &amp;quot;*******************************************************&amp;quot; @unmatched_colors&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; try {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; #Write-Host &amp;quot;******************* Moving ************************&amp;quot; $contact.Name&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Move-QADObject -Identity $contact.Name -NewParentContainer $unmatched_OU -ErrorAction &amp;#39;Stop&amp;#39; -ErrorVariable $moveError&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; } catch [System.OutOfMemoryException] {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Warning &amp;quot;Out of RAM&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; $errorTime = Get-Date -UFormat &amp;quot;%d-%m-%d-%Y_%H%M&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Host &amp;quot;Memory Error:&amp;quot; $errorTime | Out-File &amp;quot;$report_path\Function_Report_$timeStamp.txt&amp;quot; -Append&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Throw &amp;quot;Memory Error&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; } catch {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Warning &amp;quot;Error moving contact&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Get_Reports $contact &amp;quot;Error_Unmatched_Users&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; } finally {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Get_Reports $contact &amp;quot;Unmatched_Contacts&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; } # end finally&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; } # end if (!(Get-QADUser)&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; else {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## Set variables&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; $new_email = $contact.PrimarySMTPAddress&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## Generate Report prior to cleanup&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Get_Reports $user &amp;quot;Pre-Cleanup_Users&amp;quot;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; try {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## Remove contact so that the new email address can be set as the primary address for the user.&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Remove-QADObject -Identity $contact.name -Force&amp;nbsp;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## Process user accounts&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; $user | Set-QADUser -ObjectAttributes @{altRecipient=&amp;#39;&amp;#39;; msExchHomeServerName=&amp;#39;&amp;#39;; homeMDB=&amp;#39;&amp;#39;; targetAddress=&amp;quot;$new_email&amp;quot;}`&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; | Add-QADProxyAddress -Type &amp;quot;SMTP&amp;quot; -Address $new_email -Primary ` &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; | Remove-QADProxyAddress -Pattern &amp;quot;*@oldemail1.com&amp;quot;`&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; | Remove-QADProxyAddress -Pattern &amp;quot;*@oldemail2.com&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; } catch [System.OutOfMemoryException] {&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Warning &amp;quot;Out of RAM&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; $errorTime = Get-Date -UFormat &amp;quot;%d-%m-%d-%Y_%H%M&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Host &amp;quot;Memory Error:&amp;quot; $errorTime | Out-File &amp;quot;$report_path\Function_Report_$timeStamp.txt&amp;quot; -Append&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Throw &amp;quot;Memory Error&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; } catch {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Warning &amp;quot;Error moving user&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Get_Reports $user &amp;quot;Error_Users&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; &amp;nbsp; } finally {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## Generate report after user changes have been applied&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Get-QADUser $user.Name | % {Get_Reports $_ &amp;quot;Post-Cleanup_Users&amp;quot;}&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; &amp;nbsp; } # end finally&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; } # end else&lt;/p&gt;
&lt;p class="p1"&gt;} # end function Process_Users&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;## Function to create pop-up message(s) with information about the script and initiate the rest of the functions if the user chooses to do so.&lt;/p&gt;
&lt;p class="p1"&gt;function Notifications {&lt;/p&gt;
&lt;p class="p1"&gt;$script_description = &amp;quot;This script will go through Active Directory and match ... {script description}.&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;Do you wish to proceed?&amp;quot;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; $a = New-Object -ComObject wscript.shell&lt;/p&gt;
&lt;p class="p1"&gt;$proceed = $a.popup($script_description,0,&amp;quot;Script Description&amp;quot;,4)&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; if ($proceed -eq 6) {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; ## Answered &amp;quot;Yes&amp;quot;, proceed with script&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; Write-Host &amp;quot;YES&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; Write-Host &amp;quot;Processing Contacts and Users&amp;quot;&amp;nbsp;&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; ## Process users&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; Get-QADObject @contact_splat | %{Get_Reports $_ &amp;quot;Contacts&amp;quot;} | % {Process_Users $_}&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; Invoke-Item $report_path&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; } # end if&lt;/p&gt;
&lt;p class="p1"&gt;else {&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; ## Answered &amp;quot;NO&amp;quot; exit script.&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; Write-Host &amp;quot;*** Exiting Script ***&amp;quot;&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp; } # end else &amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;} # end function Notifications&lt;/p&gt;
&lt;p class="p1"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="p1"&gt;## Run the notification and give the user an option to terminate program before executing.&lt;/p&gt;
&lt;p class="p1"&gt;Notifications&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Import data from Powershell to SQL Server</title><link>http://powershell.com/cs/forums/thread/22111.aspx</link><pubDate>Tue, 12 Mar 2013 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:22111</guid><dc:creator>Staggerlee011</dc:creator><description>&lt;p&gt;Hi everyone,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Not sure of this is the easist way. But id like to get a list of all the Servers in AD into a table in SQL Server. I can get the list of servers from AD in powershell. But i cant find a way to take data from powershell and put it directly into SQL. Lots of articles and blogs on importing CSV data or a txt file. but none that i can find on using the pipeline.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any ideas on how to do it? Or if&amp;nbsp;there&amp;#39;s&amp;nbsp;a better way to do it!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp;&lt;/p&gt;</description></item><item><title>Username Creation </title><link>http://powershell.com/cs/forums/thread/21770.aspx</link><pubDate>Thu, 21 Feb 2013 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:21770</guid><dc:creator>gelmera</dc:creator><description>&lt;p&gt;Team,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am&amp;nbsp;trying&amp;nbsp;to develop a function for my account creation script that creates the username.&lt;/p&gt;
&lt;p&gt;as of now this it what i have.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;### Creating Username And Validation Test Function ###&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[System.Reflection.Assembly]::LoadWithPartialName(&amp;#39;Microsoft.VisualBasic&amp;#39;) | Out-Null&lt;/p&gt;
&lt;p&gt;$Firstname = [Microsoft.VisualBasic.Interaction]::InputBox(&amp;quot;Enter Firstname of User&amp;quot;)&lt;/p&gt;
&lt;p&gt;$Lastname = [Microsoft.VisualBasic.Interaction]::InputBox(&amp;quot;Enter Lastname of User&amp;quot;)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;$username= (($FirstName.Substring(0,1)) + ($LastName))&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;if ( $username.Length -gt 12) {&lt;/p&gt;
&lt;p&gt;Write-Host &amp;quot;Charecter Longer than 12 charecters&amp;quot;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My&amp;nbsp;dilemma&amp;nbsp;is that i can not have a username longer than 12&amp;nbsp;characters&amp;nbsp;for now. I am not sure how to approach this i already have to validate the username for&amp;nbsp;availability&amp;nbsp;in the domain and on a&amp;nbsp;separate&amp;nbsp;csv file for sap username.&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m looking for a way that if the user name&amp;nbsp;length&amp;nbsp;is -gt 12 to be able to set it to 12&amp;nbsp;characters.&lt;/p&gt;</description></item><item><title>Map drives based on AD Membership from a non-trusted AD domain</title><link>http://powershell.com/cs/forums/thread/21685.aspx</link><pubDate>Tue, 19 Feb 2013 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:21685</guid><dc:creator>neilthomas</dc:creator><description>&lt;p&gt;Hi guys,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m fairly new to scripting and hope you can help. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am performing data migration between 2 domains (Domain A &amp;amp; Domain B) that aren&amp;#39;t trusted. I need to map drives to the new domain B based on group membership using new domain B credentials.&lt;/p&gt;
&lt;p&gt;I have a script to map drives based on group membership which works fine in the same domain.&lt;/p&gt;
&lt;p&gt; I am having trouble connecting to domain B from A and then running script as Domain B credentials and not not default username if that makes sense&lt;/p&gt;
&lt;p&gt;Passing credentials bit i need help with&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;$cred = Get-Credential -Message &amp;quot;Please enter your username Domain\Username&amp;quot;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;$networkCred = $cred.GetNetworkCredential()&lt;/p&gt;
&lt;p&gt;Enter-PSSession &amp;ndash;computerName server -credential $networkcred&lt;/p&gt;
&lt;p&gt;$strName = $networkcred.username&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Map drives script ( works fine in same domain)&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;# ====================================================&lt;/p&gt;
&lt;p&gt;# Queries user account in AD for user group membership&lt;/p&gt;
&lt;p&gt;# ====================================================&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;$strName = $env.username (changed to $networkcred.username whilst trying above)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;function get-GroupMembership($DNName,$cGroup){&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$strFilter = &amp;quot;(&amp;amp;(objectCategory=User)(samAccountName=$strName))&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$objSearcher = New-Object System.DirectoryServices.DirectorySearcher&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$objSearcher.Filter = $strFilter&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$objPath = $objSearcher.FindOne&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$objUser = $objPath.GetDirectoryEntry&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$DN = $objUser.distinguishedName&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$strGrpFilter = &amp;quot;(&amp;amp;(objectCategory=group)(name=$cGroup))&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$objGrpSearcher = New-Object System.DirectoryServices.DirectorySearcher&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$objGrpSearcher.Filter = $strGrpFilter&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$objGrpPath = $objGrpSearcher.FindOne&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;If (!($objGrpPath -eq $Null)){&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;$objGrp = $objGrpPath.GetDirectoryEntry&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;$grpDN = $objGrp.distinguishedName&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;$ADVal = [ADSI]&amp;quot;LDAP://$DN&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;if ($ADVal.memberOf.Value -eq $grpDN){&lt;/p&gt;
&lt;p&gt;&lt;span&gt;			&lt;/span&gt;$returnVal = 1&lt;/p&gt;
&lt;p&gt;&lt;span&gt;			&lt;/span&gt;return $returnVal = 1&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;}else{&lt;/p&gt;
&lt;p&gt;&lt;span&gt;			&lt;/span&gt;$returnVal = 0&lt;/p&gt;
&lt;p&gt;&lt;span&gt;			&lt;/span&gt;return $returnVal = 0&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;}&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;}else{&lt;/p&gt;
&lt;p&gt;&lt;span&gt;			&lt;/span&gt;$returnVal = 0&lt;/p&gt;
&lt;p&gt;&lt;span&gt;			&lt;/span&gt;return $returnVal = 0&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;}&lt;/p&gt;
&lt;p&gt;&lt;span&gt;		&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;# ====================================================&lt;/p&gt;
&lt;p&gt;# Map network drives&lt;/p&gt;
&lt;p&gt;# ====================================================&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;$result = get-groupMembership $strName &amp;quot;map_Z&amp;quot;&lt;/p&gt;
&lt;p&gt;if ($result -eq &amp;#39;1&amp;#39;) {&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$(New-Object -ComObject WScript.Network).RemoveNetworkDrive(&amp;quot;Z:&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;span&gt;	&lt;/span&gt;$(New-Object -ComObject WScript.Network).MapNetworkDrive(&amp;quot;Z:&amp;quot;, &amp;quot;\\server\share&amp;quot;);&lt;/p&gt;
&lt;/p&gt;</description></item><item><title>Finding Windows server's hard disk space and availabe disk space </title><link>http://powershell.com/cs/forums/thread/21657.aspx</link><pubDate>Mon, 18 Feb 2013 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:21657</guid><dc:creator>felbemi94</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Looking for Power-shell script using version 2 or 3&amp;nbsp;that will compile a&amp;nbsp;text&amp;nbsp;file and retrieve the&amp;nbsp;Windows server&amp;#39;s (2003, 2008)&amp;nbsp;hard disk&amp;nbsp;and available disk space for 1000 servers.&lt;/p&gt;
&lt;p&gt;This can be run in a Domain Controller 2003&amp;nbsp;(dev environment) I have domain admin access.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>MY Boss was asked to get these reports ASAP, Please help me</title><link>http://powershell.com/cs/forums/thread/21531.aspx</link><pubDate>Mon, 11 Feb 2013 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:21531</guid><dc:creator>vbr.mohan</dc:creator><description>&lt;p class="MsoListParagraph" style="text-indent:-0.25in;margin:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;"&gt;&lt;span style="color:#44546a;mso-fareast-font-family:Calibri;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraph" style="text-indent:-0.25in;margin:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;"&gt;&lt;span style="color:#44546a;mso-fareast-font-family:Calibri;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;1.&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#44546a;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;A list of all GPOs that run a script, what the scripts name is, and what it&amp;rsquo;s function is, if you can figure it out.&amp;nbsp; If the script is mapping drives, printers, or pulling files from a location we need to verify that those devices/locations/files still exist.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraph" style="text-indent:-0.25in;margin:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;"&gt;&lt;span style="color:#44546a;mso-fareast-font-family:Calibri;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;2.&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#44546a;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;A list of all GPOs that are not linked to anything, and if possible what their function is.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraph" style="text-indent:-0.25in;margin:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;"&gt;&lt;span style="color:#44546a;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraph" style="text-indent:-0.25in;margin:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;"&gt;&lt;span style="color:#44546a;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraph" style="text-indent:-0.25in;margin:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;"&gt;&lt;span style="color:#44546a;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;How can i get the Reports of GPO&amp;#39;s which are running Scripts ?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraph" style="text-indent:-0.25in;margin:0in 0in 0pt 0.5in;mso-list:l0 level1 lfo1;"&gt;&lt;span style="color:#44546a;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Please Help me&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Beginner Scripter - HashTable Issue</title><link>http://powershell.com/cs/forums/thread/21538.aspx</link><pubDate>Mon, 11 Feb 2013 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:21538</guid><dc:creator>Trey</dc:creator><description>&lt;p&gt;Hello All,&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:23px;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;background-color:#ffffff;float:none;font-family:&amp;#39;Droid Serif&amp;#39;,Georgia,&amp;#39;Times New Roman&amp;#39;,serif;color:#222222;"&gt;Hello All,&lt;/span&gt;&lt;br style="font-size:14px;font-family:&amp;#39;Droid Serif&amp;#39;, Georgia, &amp;#39;Times New Roman&amp;#39;, serif;color:#222222;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:23px;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;background-color:#ffffff;" /&gt;&lt;br style="font-size:14px;font-family:&amp;#39;Droid Serif&amp;#39;, Georgia, &amp;#39;Times New Roman&amp;#39;, serif;color:#222222;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:23px;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;background-color:#ffffff;" /&gt;&lt;span style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:23px;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;background-color:#ffffff;float:none;font-family:&amp;#39;Droid Serif&amp;#39;,Georgia,&amp;#39;Times New Roman&amp;#39;,serif;color:#222222;"&gt;&lt;span class="Apple-converted-space"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:23px;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;background-color:#ffffff;float:none;font-family:&amp;#39;Droid Serif&amp;#39;,Georgia,&amp;#39;Times New Roman&amp;#39;,serif;color:#222222;"&gt;&lt;span class="Apple-converted-space"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:23px;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;background-color:#ffffff;float:none;font-family:&amp;#39;Droid Serif&amp;#39;,Georgia,&amp;#39;Times New Roman&amp;#39;,serif;color:#222222;"&gt;&lt;span style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:23px;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;background-color:#ffffff;float:none;font-family:&amp;#39;Droid Serif&amp;#39;,Georgia,&amp;#39;Times New Roman&amp;#39;,serif;color:#222222;"&gt;I am looking for extra parameters, that can list all distribution groups and their email address ... along with their respective members and their individual primary email address.&amp;nbsp; The script below, only lists Group Name / Member / Member Email.&amp;nbsp; What I need is GroupName | GroupName Email | Member | Member Email.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s what I&amp;#39;ve been trying to work with:&lt;/p&gt;
&lt;p&gt;$Groups = &amp;quot;company.com/distributionlist&amp;quot;&lt;br /&gt;&lt;br /&gt;Get-QADGroup -SearchRoot $Groups -SizeLimit 0 | Foreach-Object{&lt;br /&gt;$group = $_&lt;br /&gt;Get-QADGroupmember $group -sizelimit 0 | `&lt;br /&gt;select @{n=&amp;quot;GroupName&amp;quot;;e={$group}},displayname,email&lt;br /&gt;} | export-Csv&amp;nbsp; C:\FullDG001.csv&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:23px;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;background-color:#ffffff;float:none;font-family:&amp;#39;Droid Serif&amp;#39;,Georgia,&amp;#39;Times New Roman&amp;#39;,serif;color:#222222;"&gt;Can anyone please help?!&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Listing User Attributes for Enabled and Disabled Users</title><link>http://powershell.com/cs/forums/thread/21436.aspx</link><pubDate>Tue, 05 Feb 2013 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:21436</guid><dc:creator>drex</dc:creator><description>&lt;p&gt;Hello.&lt;/p&gt;
&lt;p&gt;I am having trouble trying to change the name of attributes for enabled and disabled accounts using Get-QADUser.&amp;nbsp; For example, I&amp;#39;d like the useraccountcontrol attribute to display, &amp;quot;Enabled&amp;quot; or &amp;quot;Disabled&amp;quot; instead of 512 and 514. Essentially, I am trying to create a GUI which allows the person to select multiple attributes to be displayed in a csv file. Here is my current script without the GUI. Any ideas how I can clean this up and make it more functional? Thanks!&lt;/p&gt;
&lt;p&gt;####&lt;br /&gt;$CDays = Read-host &amp;quot;Created more than xx days ago&amp;quot;&lt;br /&gt;#&lt;br /&gt;$LDays = Read-Host &amp;quot;Logon more than xx days ago&amp;quot;&lt;br /&gt;#&lt;br /&gt;$created = (Get-Date).AddDays(-$CDays)&lt;br /&gt;#&lt;br /&gt;$logon = (Get-Date).AddDays(-$LDays)&lt;br /&gt;#&lt;br /&gt;$users = Get-QADUser &amp;#39;domain\OU&amp;#39; -IncludeAllProperties &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;@(foreach($user in $users)&lt;br /&gt;{&lt;br /&gt;$user | Select-Object DisplayName,LogonName,description,manager,createTimeStamp,lastLogonTimestamp,userAccountControl | where {$_.lastLogonTimestamp -le $logon} | where {$_.createTimeStamp -le $created}&lt;br /&gt;})| export-Csv &amp;quot;c:\test\report.csv&amp;quot; -noType&lt;br /&gt;#####&lt;/p&gt;</description></item></channel></rss>