- This topic has 4 replies, 2 voices, and was last updated 7 months, 3 weeks ago by
December 11, 2019 at 3:03 pm #192757
I’ve been scouring the internet and haven’t found a solution.
Generally I can get around most things. But the DFSR commandlets don’t take credential parameters.
So trying to run powershell as the system account has me stuck.
as such none of the DFSR commandlets work. Import-module DFSR doesn’t work either.
I can’t seem to use anything outside of psexec to run the powershell commands as the appropriate user but i’d rather not.
Module dump and errors below.
C:\Program Files\WindowsPowerShell\Modules;WindowsPowerShell\Modules;C:\Program Files (x86)\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
import-module : The specified module ‘C:\windows\system32\windowspowershell\v1.0\Modules\DFSR\DFSR.PSD1’ was not
loaded because no valid module file was found in any module directory.
December 11, 2019 at 3:48 pm #192805ParticipantTopics: 13Replies: 1683Points: 2,849Rank: Community Hero
There appears to be other posts with the same issue:
This post also indicates there is a personal DFSR module and official module installed via Windows. Confirm you are using the official module.
Next, the error received is indicating that the module was not found or there was an error loading the module, which appears to be the latter based on the short name (e.g. DFSR) resolving to a path (e.g. C:\windows\system32\windowspowershell\v1.0\Modules\DFSR\DFSR.PSD1). This can be further confirmed by importing the module using the full path:
Assuming that the module still does not load, there is most likely a bug or issue in the module itself. You’ve mentioned you are trying to launch the Powershell session as SYSTEM, are you just troubleshooting to see if it works or you’ve confirmed that importing the module as SYSTEM works successfully?
December 11, 2019 at 3:57 pm #192820
I am using the stock windows DFSR module.
Importing the module as the system account doesn’t work. (when ran from the deployment tool) But using psexec it does work. (IE: manually typing import-module dfsr after doing psexec -s -i powershell.exe
But importing the module as any other domain account works fine. if executing it from the deployment tool.
Since the commands inside the module aren’t designed to take alternative credentials and the deployment tool i’m using starts as the system account on the machine my options are normally using psexec. But i’m trying to get away from using psexec to execute powershell scripts.
Every other module i’ve seen either Active Directory or DHCP has some mechanism to take alternative credentials except for DFS.
December 11, 2019 at 6:51 pm #192895ParticipantTopics: 13Replies: 1683Points: 2,849Rank: Community Hero
The best option is having the SYSTEM account launch another Powershell session as the needed user:
You can create a credential object with plain text, but that means you are storing the password as plain text. Secure string encryption uses the computer, so if you are deploying, you’ll need to look at storing credentials securely with certificate or another method.
December 11, 2019 at 10:12 pm #192994
so the specific DFSR fixlets i want to use actually have to be ran from an administrator power shell.
The URL you gave me earlier didn’t seem to work after trying several different methods.
My boss is having me punt for now and go back to psexec.
- The topic ‘powershell as system account.’ is closed to new replies.