<?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 'powershel active directory change profile path homefolder homedirectory ip to dns'</title><link>http://powershell.com/cs/search/SearchResults.aspx?q=(app:forums+OR+groupid:24)&amp;tag=powershel+active+directory+change+profile+path+homefolder+homedirectory+ip+to+dns&amp;orTags=0&amp;o=DateDescending</link><description>Search results for '(app:forums OR groupid:24)' matching tag 'powershel active directory change profile path homefolder homedirectory ip to dns'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><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>passwords</title><link>http://powershell.com/cs/forums/thread/10993.aspx</link><pubDate>Thu, 23 Jun 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10993</guid><dc:creator>pat wrigley</dc:creator><description>&lt;p&gt;does anyone know of a powershell script to do a Read-Host to get user input for an AD account name.&amp;nbsp; and then set the account to force the user to change their password at the next login?&lt;/p&gt;
&lt;p&gt;Thanks in advance for any help.&lt;/p&gt;</description></item><item><title>How do I query oab in powershell?</title><link>http://powershell.com/cs/forums/thread/10857.aspx</link><pubDate>Wed, 15 Jun 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10857</guid><dc:creator>jwhite</dc:creator><description>&lt;p&gt;There is an AD Exchange attribute &amp;quot;MsExchUseOAB&amp;quot; to show what oab users are pointing to.&amp;nbsp; How could&amp;nbsp;I view this in powershell for a user?&amp;nbsp; I tried get-aduser, get-user, and get-mailbox but no luck.&amp;nbsp; Any ideas??&amp;nbsp; Thanks!&lt;/p&gt;</description></item><item><title>powershell script to change ip to dns in profilepath and homedirectory path in AD</title><link>http://powershell.com/cs/forums/thread/10195.aspx</link><pubDate>Sun, 01 May 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10195</guid><dc:creator>thwer</dc:creator><description>&lt;p&gt;Hi there !&lt;/p&gt;
&lt;p&gt;i just wanted to post a script i just made.&lt;/p&gt;
&lt;p&gt;At work, the path to profile and homefolders have been, in the past years, put through the unc with ip instead of dns names.&lt;/p&gt;
&lt;p&gt;So, i was asked to make a script to make massively the change for a certain IP address to a certain dns name.&lt;/p&gt;
&lt;p&gt;I thus thought that it could be great to have it done automatically for all the paths using IP and yesterday, during my free time at home, i went to my lab and done this script to change it massively.&lt;/p&gt;
&lt;p&gt;i wanted as well do it through a function more than a simple script, in order to be able, through the parameters, to choose on what we want to make the action : profilepath or homedirectory.&lt;/p&gt;
&lt;p&gt;I wanted to have your opinions (and if i could make it better, that&amp;#39;s great) and maybe it will be useful for some people having the same environment.&lt;/p&gt;
&lt;p&gt;Thanks for your comments !&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;here&amp;#39;s the script with explaination&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# As we will be working with some AD cmdlet, we need to have installed on the workstation the RSAT from MS.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# We will then use the activedirectory module&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Import-Module activedirectory&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# first i setup a function to test if the ip is valid.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# I found it on the net somewhere but can&amp;#39;t remember where.&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# Surely you&amp;#39;ll be able to find some with your preferred search engine.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;function isip {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;param([string]$ip=$(throw &amp;quot;Il manque l&amp;#39;argument de l&amp;#39;adresse ip&amp;quot;))&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;trap{&amp;quot;$ip Is not a valid IP address&amp;quot;; continue;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;[bool][system.net.ipaddress]::Parse($ip);&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;function iptodns {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# There&amp;#39;s only one parameter to enter along the function call : 0 or 1&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# so, when calling the function, you enter, for example, &amp;quot;iptodns 1&amp;quot; (deleting the double quotes...)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;param($choix=$(throw &amp;quot;Choice Argument is missing&amp;quot;))&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;#I&amp;#39;ve Setup a trap in case of error just in order to know when the error occured...&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;trap { add-content $file &amp;quot;an error occured treating ($entry.samaccountname)&amp;quot;; continue;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;#The script will switch in order to choose the item on which it&amp;#39;s going to act&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;#I&amp;#39;ve used the switch call because it&amp;#39;s really going faster than calling multiple conditions with if...else..if...else..&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# french flavour on the name of the var i&amp;#39;ve used : choix means choice&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# so if you choose profilepath, the argument for the function&amp;#39;s call is 0 and if you choose to make massive changes on the homedirectory&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# path, you&amp;#39;ll choose 1.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# depending on the choice made above will happend some actions.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;switch ($choix) {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 {&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# the use var will contain profilepath or homedirectory. I made this because, in this case i wanted to have only one function&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# to call in order to do every changes i had in mind...&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# we then create the name of the log file through a concatenation of words and var.&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# After that, the actions are straight forward till the next comment.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$use = &amp;quot;profilepath&amp;quot;&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$file = &amp;quot;c:\logsAD&amp;quot; + $use + &amp;quot;change.txt&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new-item $file -type file -erroraction &amp;quot;silentlycontinue&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;We are going to modify the $use of the Active Directory users&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 {&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$use = &amp;quot;homedirectory&amp;quot;&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$file = &amp;quot;c:\logsAD&amp;quot; + $use + &amp;quot;change.txt&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;new-item $file -type file -erroraction &amp;quot;silentlycontinue&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;We are going to modify the $use of the Active Directory users&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# Here we go for the main body of this function.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# first, i used the famouse aduser commandlet in order to retrieve the AD items i want to work with.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# Instead of placing the content in a variable and then making an output of my var and calling the foreach loop, i optimized a&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# bit the way it works especially in tipping text time... :)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;foreach ($entry in $(get-aduser -filter * -properties * -searchbase &amp;quot;ou=usersZ15,dc=Z51,dc=T&amp;quot;) ) { &amp;nbsp; &amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# &amp;nbsp;In order to output the $entry.$use with will be the profilepath or homefolder of the entry (the entry being the item of the user)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# i put the result in the actionon var. In fact, this is simply to workaround my way because if you&amp;#39;d put $entry.$use between the double quotes&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# the result wouldn&amp;#39;t have been to enter in the log file the server name.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$actionon = ($entry.$use)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if ($actionon -ne $null) {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;we are going to change the $use of the user $entry&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# when you make a split on the unc, you have a few empty drops in your array.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# to work that arround, i used the removeemptyentries which makes that the first element of the array in the $split var will be&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# the ip address i&amp;#39;ll be changing...&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[array]$split = ($entry.$use).split(&amp;quot;\&amp;quot;,[stringsplitoptions]::removeemptyentries)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;here is the spliting of the $use :&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$split | foreach { add-content $file $_ }&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# once again, as the $split[0] will return the elements of the array on the same line and string in my log file, i created the ip&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# var in order to work this arround.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$ip = $split[0]&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if ((isip $ip) -eq $true) {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;($ip) is a valid IP address&amp;quot;&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# here i used a switch op on the ip because, in the environment this script will be working on, i can&amp;#39;t use a call to the reverse&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# lookup zone in the dns, as some of the servers don&amp;#39;t have any PTR record in there...&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# this works if you&amp;#39;re table isn&amp;#39;t long that much but, in a relatively well maintained environment, you would just call on the&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# DNS with a function to obtain the inverse resolution and have the server&amp;#39;s name worked out.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;switch ($ip) {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;172.16.1.10&amp;quot; { $split[0] = &amp;quot;prf01.Z51.T&amp;quot; }&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;172.16.1.11&amp;quot; { $split[0] = &amp;quot;prf02.Z51.T&amp;quot; }&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;172.16.1.12&amp;quot; { $split[0] = &amp;quot;prf03.Z51.T&amp;quot; }&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;172.16.1.13&amp;quot; { $split[0] = &amp;quot;prf04.Z51.T&amp;quot; }&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;172.16.1.14&amp;quot; { $split[0] = &amp;quot;prf05.Z51.T&amp;quot; }&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;172.16.1.15&amp;quot; { $split[0] = &amp;quot;prf06.Z51.T&amp;quot; }&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# i wanted to add in the log file, alongside the ip address we&amp;#39;re living, the new name which will be replacing the ip.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# thus, i created another var which will be receiving the new name after we changed the split[0] var&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$dnsname = $split[0]&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;($ip) has been changed in $dnsname&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# i modify directly in the user item which is in RAM the path to the homefolder or the profile.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;($entry.$use) = (&amp;quot;\\&amp;quot; + $($split[0..$split.count])).replace(&amp;quot; &amp;quot;,&amp;quot;\&amp;quot;)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$actionon = ($entry.$use)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;the $use has been changed in memory in $actionon&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;# and i finally set the modified path in the AD item, depending on the type of element we change : profilepath or homedir...&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;switch ($choix) {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 {&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set-aduser $entry.samaccountname -profilepath $entry.$use&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;the $use has been changed in Active Directory in $actionon&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 {&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set-aduser $entry.samaccountname -homedirectory $entry.$use&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;the $use has been changed in Active Directory in $actionon&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} else {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;$dnsname is not a valid IP address&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} else {&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add-content $file &amp;quot;The $use of the user $entry is empty&amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/i&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;it is indeed possible to replace the switch between the ip addresses and dns names in order to have it done automatically through a dns interrogation&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;to do this, we can replace the switch part in the function iptodns with this :&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;$split[0]&amp;nbsp;= ([system.net.dns]::gethostbyaddress($split[0])).hostname&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;here are the logs i&amp;#39;ve made through this :&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;i&gt;we are going to change the profilepath of the user CN=Thomas Werters,OU=usersZ51,DC=Z51,DC=T&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;here is the spliting of the profilepath :&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;172.16.1.10&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;prf&lt;/i&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;i&gt;thwer&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;(172.16.1.10) is a valid IP address&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;(172.16.1.10) has been changed in prf01.Z51.T&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;the profilepath has been changed in memory in \\prf01.Z51.T\prf\thwer&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;the profilepath has been changed in Active Directory in \\prf01.Z51.T\prf\thwer&lt;/i&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;so, to call the function and change massively the homedirectory for example, i would call &lt;i&gt;iptodns 1&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;to change the profilepath massively, would go for &lt;i&gt;iptodns 0 &lt;/i&gt;and&amp;nbsp;so far so good, it&amp;#39;s working well!&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;thanks a lot for your comments&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Thomas&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>