![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Powershell and cmdlet config files I just wrote my first cmdlet. It uses a config file. The first time, i: installutil mycmdlet.dll Add-PSSnapIn mycmdlet I set a breakpoint in the cmdlet, and verified that it read the config file fine. However, i made a change to the config file. I Removed the snapin, and installutil -u the dll. Rebuild the dll and config file, reinstalled it, but... it's not reading the changes to the config file. What else do I need to do? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Powershell and cmdlet config files Well, you don't *need* to uninstall it, really. Just close PowerShell and drop the new DLL atop the old one. And unfortunately the problem would be within your cmdlet code, not something in PowerShell. I'm assumiung you're reading the config file in a cmdlet's Begin method, correct? -- Don Jones Windows PowerShell MVP Founder: www.ScriptingAnswers.com Co-Author: "Windows PowerShell: TFM" "Steve" <Steve@discussions.microsoft.com> wrote in message news:CFFF3282-DC5C-4A93-9EB7-0A37C30957B5@microsoft.com... >I just wrote my first cmdlet. It uses a config file. The first time, i: > > installutil mycmdlet.dll > Add-PSSnapIn mycmdlet > > I set a breakpoint in the cmdlet, and verified that it read the config > file > fine. > > However, i made a change to the config file. I Removed the snapin, and > installutil -u the dll. Rebuild the dll and config file, reinstalled it, > but... it's not reading the changes to the config file. > > What else do I need to do? > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Powershell and cmdlet config files Don, thanks. I figured out the problem. I had a powershell.exe.config in the windowspowershell bin directory. I removed this file. Now, the question is: Can cmdlets have config files? i'm not picking up any of the AppSettings now. protected override void BeginProcessing() { username_ = String.Format(@"{0}\{1}", ConfigurationManager.AppSettings["Domain"], ConfigurationManager.AppSettings["AdminUser"]); password_ = ConfigurationManager.AppSettings["Password"]; endpoint_ = ConfigurationManager.AppSettings["Endpoint"]; base.BeginProcessing(); } "Don Jones [MVP]" wrote: > Well, you don't *need* to uninstall it, really. Just close PowerShell and > drop the new DLL atop the old one. > > And unfortunately the problem would be within your cmdlet code, not > something in PowerShell. I'm assumiung you're reading the config file in a > cmdlet's Begin method, correct? > > -- > Don Jones > Windows PowerShell MVP > Founder: www.ScriptingAnswers.com > Co-Author: "Windows PowerShell: TFM" > > "Steve" <Steve@discussions.microsoft.com> wrote in message > news:CFFF3282-DC5C-4A93-9EB7-0A37C30957B5@microsoft.com... > >I just wrote my first cmdlet. It uses a config file. The first time, i: > > > > installutil mycmdlet.dll > > Add-PSSnapIn mycmdlet > > > > I set a breakpoint in the cmdlet, and verified that it read the config > > file > > fine. > > > > However, i made a change to the config file. I Removed the snapin, and > > installutil -u the dll. Rebuild the dll and config file, reinstalled it, > > but... it's not reading the changes to the config file. > > > > What else do I need to do? > > > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Powershell and cmdlet config files Since snap-ins are DLLs, no - only EXEs can have 'em. -- Don Jones Windows PowerShell MVP Founder: www.ScriptingAnswers.com Co-Author: "Windows PowerShell: TFM" "Steve" <Steve@discussions.microsoft.com> wrote in message news:AB1891DA-ECEC-4D6B-A705-436B024DB74E@microsoft.com... > Don, thanks. > > I figured out the problem. I had a powershell.exe.config in the > windowspowershell bin directory. > > I removed this file. Now, the question is: > > Can cmdlets have config files? i'm not picking up any of the AppSettings > now. > > protected override void BeginProcessing() > { > username_ = String.Format(@"{0}\{1}", > ConfigurationManager.AppSettings["Domain"], > ConfigurationManager.AppSettings["AdminUser"]); > password_ = ConfigurationManager.AppSettings["Password"]; > endpoint_ = ConfigurationManager.AppSettings["Endpoint"]; > base.BeginProcessing(); > } > > "Don Jones [MVP]" wrote: > >> Well, you don't *need* to uninstall it, really. Just close PowerShell and >> drop the new DLL atop the old one. >> >> And unfortunately the problem would be within your cmdlet code, not >> something in PowerShell. I'm assumiung you're reading the config file in >> a >> cmdlet's Begin method, correct? >> >> -- >> Don Jones >> Windows PowerShell MVP >> Founder: www.ScriptingAnswers.com >> Co-Author: "Windows PowerShell: TFM" >> >> "Steve" <Steve@discussions.microsoft.com> wrote in message >> news:CFFF3282-DC5C-4A93-9EB7-0A37C30957B5@microsoft.com... >> >I just wrote my first cmdlet. It uses a config file. The first time, >> >i: >> > >> > installutil mycmdlet.dll >> > Add-PSSnapIn mycmdlet >> > >> > I set a breakpoint in the cmdlet, and verified that it read the config >> > file >> > fine. >> > >> > However, i made a change to the config file. I Removed the snapin, and >> > installutil -u the dll. Rebuild the dll and config file, reinstalled >> > it, >> > but... it's not reading the changes to the config file. >> > >> > What else do I need to do? >> > >> > >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Accessing powershell cmdlet via rsh | PowerShell | |||
| Powershell.exe.config | PowerShell | |||
| XML processing my web.config file in PowerShell | PowerShell | |||
| get-service cmdlet in powershell v2 (ctp) | PowerShell | |||
| can my cmdlet/snapin have a config file? | PowerShell | |||