2

A very strange thing is happening and I don't know what's causing this issue. I have a project in which I need to execute some PowerShell scripts to get some values of a SharePoint site. To do this I had installed, Windows Azure Active Directory Module. Now, the scripts are getting successfully executed from within the powershell.

Next thing, we have to run the same scripts from within the code(C#). To do this we had to add the reference of the dll, Microsoft.Online.Administration.Automation.PSModule. The problem is this dll is placed at the location,

C:\Windows\System32\WindowsPowerShell\v1.0\Modules\**MSOnline**

Though, I can browse this location using in Windows Explorer, when I try to browse the same in my Add Reference window, it's not showing the MSOnline folder!

I just want to know why a directory that can be browsed using the Explorer becomes invisible to the VS Add Reference window. My VS is running in Administrator mode.

Following is the ScreenShot of the folder, MSOnline that can be viewed in the explorer, enter image description here

And this is the ScreenShot of the same directory from the Add Reference window enter image description here

You can clearly see, its throwing the FileNotFound error. I would just like to know the reason of this weird behaviour. Thanks

Community
  • 1
  • 1
Piyush
  • 830
  • 8
  • 19

2 Answers2

0

This directory is protected by the system and requires adminstrative rights to access it. Copy the filees to other location as an administrator and add the references from there.

Aidan D
  • 16
0

I think you will still need a Runspace even if you reference the libraries of the PS module directly

vezenkov
  • 4,009
  • 1
  • 26
  • 27