powershell env:PSModulepath duplicate records Winserv 2016 TP4
I was testing some xAzure DSC configuration stuff on my Windows Server 2016 TP4 and noticed that when I was trying to use the resource it said that duplicate modules was found but I could not find any in the powershell module libraries and thus it ought to be something else,
I found the tweet that Ben Gelens sent pointing me to the $env:psmodulepath
So looking in my psmodulepath I could see that I had two records that was the same and that had to be fixed,
So to remove the duplicate I first remove both and then add the one again:
$env:PSModulePath = $env:PSModulePath –replace “;C:\\Program Files\\WindowsPowerShell\\Modules”
$env:PSModulePath = $env:PSModulePath + “;C:\Program Files\WindowsPowerShell\Modules”
Happy automating 🙂