MSOnline can't be imported on PowerShell (Connect-MsolService error) - windows

I had this issue and couldn´t find any answer. The issue was that I was trying to use Azure cdmlets to connect to O365 via c# code, but I couldn´t get the connect-msolservice.
""The term is not recognized" error when you try to run administrative Windows PowerShell cmdlets in Office 365"

After reviewing Microsoft's TechNet article "Azure Active Directory Cmdlets" -> section "Install the Azure AD Module", it seems that this process has been drastically simplified, thankfully.
As of 2016/06/30, in order to successfully execute the PowerShell commands Import-Module MSOnline and Connect-MsolService, you will need to install the following applications (64-bit only):
Applicable Operating Systems: Windows 7 to 10
Name: "Microsoft Online Services Sign-in Assistant for IT Professionals RTW"
Version: 7.250.4556.0 (latest)
Installer URL: https://www.microsoft.com/en-us/download/details.aspx?id=41950
Installer file name: msoidcli_64.msi
Applicable Operating Systems: Windows 7 to 10
Name: "Windows Azure Active Directory Module for Windows PowerShell"
Version: Unknown but the latest installer file's SHA-256 hash is D077CF49077EE133523C1D3AE9A4BF437D220B16D651005BBC12F7BDAD1BF313
Installer URL: https://technet.microsoft.com/en-us/library/dn975125.aspx
Installer file name: AdministrationConfig-en.msi
Applicable Operating Systems: Windows 7 only
Name: "Windows PowerShell 3.0"
Version: 3.0 (later versions will probably work too)
Installer URL: https://www.microsoft.com/en-us/download/details.aspx?id=34595
Installer file name: Windows6.1-KB2506143-x64.msu

After hours of searching and trying I found out that on a x64 server the MSOnline modules must be installed for x64, and some programs that need to run them are using the x86 PS version, so they will never find it.
[SOLUTION]
What I did to solve the issue was:
Copy the folders called MSOnline and MSOnline Extended from the source
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
to the folder
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules\
And then in PS run the Import-Module MSOnline, and it will automatically get the module :D

The solution with copying 32-bit libs over to 64-bit did not work for me. What worked was unchecking Target Platform Prefer 32-bit check mark in project properties.

I'm using a newer version of the SPO Management Shell. For me to get the error to go away, I changed my Import-Module statement to use:
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking;
I also use the newer command:
Connect-SPOService

Connects to both Office 365 and Exchange Online in one easy to use script.
REMINDER: You must have the following installed in order to manage Office 365 via PowerShell.
Microsoft Online Services Sign-in Assistant:
http://go.microsoft.com/fwlink/?LinkId=286152
Azure AD Module for Windows PowerShell
32 bit - http://go.microsoft.com/fwlink/p/?linkid=236298
64 bit - http://go.microsoft.com/fwlink/p/?linkid=236297
MORE INFORMATION FOUND HERE:
http://technet.microsoft.com/en-us/library/hh974317.aspx

The following is needed:
MS Online Services Assistant needs to be downloaded and installed.
MS Online Module for PowerShell needs to be downloaded and installed
Connect to Microsoft Online in PowerShell
Source: http://www.msdigest.net/2012/03/how-to-connect-to-office-365-with-powershell/
Then
Follow this one if you're running a 64bits computer:
I’m running a x64 OS currently (Win8 Pro).
Copy the folder MSOnline from (1) –> (2) as seen here
1) C:\Windows\System32\WindowsPowerShell\v1.0\Modules(MSOnline)
2) C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules(MSOnline)
Source: http://blog.clauskonrad.net/2013/06/powershell-and-c-cant-load-msonline.html
Hope this is better and can save some people's time

Related

Windows RSAT Features On Demand offline installation through DISM not working

Afternoon,
I am currently trying to install RSAT DNS Tools and Volume Activation Tools through DISM using PowerShell on a computer without internet. My environment is widely off the internet and thus not able to do this the normal way. I have the cab files for both downloaded off Microsoft VLSC, of those features but I get an error of: Add-Windows Capability: The source files could not be found.
My code used is"
Add-WindowsCapability -online -name rsat.dns.tools~~~~0.0.1.0 -limitaccess -source C:\Source\BuildSource\Laptop\02-AdminCenter\RSATTools\
I've also set the source path to the overarching CAB file as well (C:\Source\BuildSource\Laptop\02-AdminCenter\RSATTools\Microsoft-Windows-DNS-Tools-FoD-Package~31bf3856ad364e35~amd64~en-US~.cab and get the same error. Any help would be greatly appreciated!
Was able to solve it by mounting the original iso and not going through the specific cab files

Run appx file in current Windows 10 device using the PowerShell cmdlets

I have an appx file which was generated elsewhere and I would like to test it in my Windows 10 machine.
The appx file is already available to me and I can deploy it to other devices using the WinAppDeployCmd, which works for the XBox One. This works perfectly with the following command:
WinAppDeployCmd install -file "!MY_FILE!" -ip "!DEVICE_IP!" -pin "!DEVICE_PIN!"
My question is, is there a similar command to simply run my .appx in the windows machine where it currently is? Is there perhaps even a way to use the WinAppDeployCmd to install it in the current machine?
I don't know about cmd, but in PowerShell you can use
Add-AppxPackage -Path C:\Users\User\MyApp.appx
If the package is unsigned, you will need to enable developer mode in Windows 10 before it can be installed.
Open Settings.
Click on Update & security
Click on For developers.
Under “Use developer features”, enable Developer mode.
More information on Add-AppxPackage: https://technet.microsoft.com/en-us/library/hh856048.aspx
Update: Regarding using WinAppDeployCmd for this see: Can I Use WinAppDeployCmd install, update on pc itself

Compiled Visual Basic Application gets Runtime Error 52 in Windows 8

The application that I compiled via Visual Basic 6 can run on my Windows XP computer. But when I execute the same executable on my other computer that runs Windows 8, I always get Runtime Error 52-Bad File name or number as soon as I launch it. I can't run the program even if there is no "Shell command" in that program which leads to a "Bad file name" error.
I used "Package and Deployment wizard" for the packaging process.
And also I registered the needed DLL's on the Windows 8 PC manually via the regsvr32 command line utility.
I also cleaned the whole registry via a registry cleaner (Wise Registry Cleaner). I used compatibility mode for Windows XP but nothing solved the problem.
Additional informations:
XP Version - SP 2
Windows 8 Version-8.1
VB - VB 6.0
Assuming that your code is
If Dir("C:/file.txt") = "" Then...
Change it to a backslash ("\")
After some research I found the answer for the problem. That was not a problem in the coding; it was ALL about windows 8 compatibility.
Go to the “Compatibility” tab of the properties window of the file and select “Windows XP SP2” under the “Compatibility mode”. That’s all
Windows 8 no longer allows you to write programmatically in the root of drive C:\ (and in many others 'system' folders like Program Files, Windows, System32, ...).
Try to use a sub-folder.

Import-Module : The specified module 'msonline' was not loaded because no valid module file was found in any module directory

Error :
Import-Module : The specified module 'msonline' was not loaded because no valid module file was found in any module directory
The error pops up when I try to load the module by typing :
Import-Module MSOnline
tried to install the Azure AD powershell module on my computer so I'd be able to make PSSession using the MSONLINE cmdlets.
After I installed the Microsoft Online Services Sign-in Assistant (version7.250.4556.0) and then installed the latest Windows Azure AD Module for Windows Powershell, I get the above error in the title.
I can do following cmd and get output :
(get-item C:\Windows\System32\WindowsPowerShell\v1.0\Modules\MSOnline\Microsoft.Online.Administration.Automation.PSModule.dll).VersionInfo.FileVersion
Output :
1.0.8362.1
I was originally following this guide :
https://onlinehelp.coveo.com/en/ces/7.0/administrator/installing_the_windows_azure_ad_module_for_windows_powershell.htm
I can confirm on another computer where this Module is working fine that the files in the path (where the module files should reside) are the same as my computer that isn't working :
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\MSOnline
I've already rebooted after installation. I've tried to install different version of the Azure AD Module from here to no avail.
Hardware/Software Version info :
Computer : Microsoft Surface Pro 3
OS Version : Windows 8.1 64-bit
PowerShell Version : Major 4 Minor 0 Build -1 Revision -1
Any help with this is greatly appreciated.
I found out the issue.
There are 2 binaries that you need to install to get this working :
Microsoft Online Services Sign-In Assistant for IT Professionals RTW
Azure Active Directory Module for Windows PowerShell
Both of these need to be the 64bit version to work together (in my case since I have a x64bit OS).
When I was trying to install the Online Services Sign-In Assistant through IE it kept giving me the 32bit MSI, even though I was asking for the 64bit installer.
I realized this after I tried to save the file, instead of just hitting RUN on the download.
Once I switched to chrome I was able to download the 64bit version.
After I had the 64bit version of both binaries installed everything worked as expected.

Installing PacketBeat on Windows

I am unable to find a reliable way to install elastic's packetbeat on windows. I know I'll have to download source and create my own windows package. However, all instructions are outdated and are from before it moved to elastic's domain.
Anyone know how to compile this package for windows?
Download and install WinPcap from this page. WinPcap is a library that uses a driver to enable packet capturing.
Download the Packetbeat Windows zip file from here.
Extract the contents of the zip file into C:\Program Files.
Rename the packetbeat--windows directory to Packetbeat.
Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select Run As Administrator). If you are running Windows XP, you may need to download and install PowerShell.
Run the following commands to install Packetbeat as a Windows service:
PS > cd 'C:\Program Files\Packetbeat'
PS C:\Program Files\Packetbeat> .\install-service-packetbeat.ps1
Note
If script execution is disabled on your system, you need to set the execution policy for the current session to allow the script to run. For example: PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-packetbeat.ps1.
Before starting Packetbeat, you should look at the configuration options in the configuration file, for example C:\Program Files\Packetbeat\packetbeat.yml or /etc/packetbeat/packetbeat.yml
Here is the link to the documentation of installing packetbeat on windows.
Follow the instructions on this page to install packetbeat on your windows machine.
Note:
winpcap.dll is required for packetbeat to function on a windows machine. WinPCap itself isn't currently supported, so the current best practice is to use npcap in winpcap compatibility mode instead. See this section of the Packetbeat FAQ
You can download npcap's installer here.
The command line call to install npcap (version 0.86) in winpcap compatibility mode is:
npcap-0.86.exe /winpcap_mode=yes
The silent install would be:
npcap-0.86.exe /S /winpcap_mode=yes

Resources