The DSC provisioner could not be found - powershell

I am trying to build a local development environment with vagrant, Packer And DSC.
And I have an error saying that DSC is not found, from my understanding DSC come with Powershell 4.0 and I checked the version I have it is 5.0 (I tried to install with INSTALL-MODULE and nothing change)
I am following this blog post : http://www.onegeek.com.au/articles/machine-factories-part1-vagrant
Running in windows 10
And here is the vagrant file I use https://gist.github.com/mefellows/7e25d5dba254d5d38b51#file-vagrantfile
The error message is :

You will need to install the Vagrant DSC plugin first:
vagrant plugin install vagrant-dsc
See https://github.com/mefellows/vagrant-dsc for more details.
I have updated the gist from that article, apologies for that omission.

Related

Install SCVMM 2022 agent on AlmaLinux 9 VM

I am trying to install SCVMM 2022 agent on AlmaLinux 9.
I discovered that the agent script is trying to use init.d while in AlmaLinux, there is no compatibility with init.d anymore but only systemd.
I updated the install script to copy the agent exec in /etc/systemd/system.
Now, I have a new error "Unable to find service control mechanism".
I understand that the script is unable to register the agent daemon in systemd.
How can I do to get the agent registered.
Have anyone ever have that issue with RedHat9 or any other forks in SCVMM 2022?
I'm just working on this (literally) right now, and while I can't get you a complete answer, I can tell you I've done the following and gotten it to at least install so I can create the template. Here's my notes up to this point, after creating the VM and copying the scvmm agent:
Install initscripts to create /etc/{init.d,rc.d,etc} folders
sudo yum install initscripts -y
https://centos.pkgs.org/9-stream/centos-baseos-x86_64/initscripts-10.11.1-1.el9.x86_64.rpm.html
Run install script for scvmm
sudo ./install scvmmguestagent.1.0.0.544.x64.tar
https://learn.microsoft.com/en-us/system-center/vmm/vm-linux?view=sc-vmm-2022
Shut down VM in VMware
Clone to template
I noticed that they don't offer RHEL 9 in their Guest OS Profile, so it may only be half supported. I'm also using VMware, you may have better luck if you're using Hyper-V

Azure Data Studio Machine Learning - Python and R Packages not being recognized

I'm setting up Azure Data Studio ( ADS ) 1.29 running the Machine Learning extension , to manage SQL 2019 Machine Learning Services in Win2016. The reason for running ADS is so I can install Python and R packages into SQL MLS via ADS. Ultimately we will use this against an Azure SQL Managed Instance ( MI ).
I have configured the default Python and R directories installed by SQL 2019 MLS on the server, as my Python and R machine learning paths in Settings\Extensions\Machine Learning.
When I go to the ADS Machine learning extension and click on "Manage Packages" I get these errors which I cant resolve :
"the following R packages are required to be installed vctrs, odbc , sqlmlutils"
These R packages are confirmed installed in SQL server.
Not sure how you check if they are installed in ADS?
"the following python packages are required to be installed sqlmlutils==1.0.3"
These Python packages are confirmed installed in both ADS and SQL server.
"Failed to complete task 'Verifying package management dependencies' : Error invalid selection.
This error directly above seems to be a result of the first 2 errors.
I have tried reinstalling ADS in new directory etc but this has not worked.
Any assistance appreciated....
A solution :
It appears when you configure ADS it needs this very specific configuration, right down to the .exe name
Machine Learning: Python Path :
C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\PYTHON_SERVICES\python.exe
Machine Learning: R Path :
C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\R_SERVICES\bin\R.exe
Install this SSL workaround for Python, if needed from
https://sourceforge.net/projects/openssl-for-windows/
file is : Win64OpenSSL_Light-1_1_1k.msi
Also you need to install the odbc and sqlmlutils as per these instructions :
https://github.com/microsoft/sqlmlutils/blob/master/R/README.md
Windows
Download the latest release from https://github.com/microsoft/sqlmlutils/releases:
From command prompt in directory where R.exe resides , run
R.exe -e "install.packages('odbc')"
R.exe CMD INSTALL sqlmlutils_1.0.0.zip
Once all this installs and runs, you should then be presented with an option to manage both Python and R packages within the Machine Learning extension.
We also found R packages could not be installed in SQL MAnaged Instance or On Prem until you go to ADS version 1.31.0 or higher.

How to install GroupPolicy module for PowerShell?

I just started writing scripts in PowerShell.
The desired script is supposed to create a local GroupPolicyObject (GPO) which will be specified afterwards. Research showed that it could be done with the New-GPO command within the GroupPolicy module for PowerShell. I tried to install the mentioned module but unfortunately nothing I found worked. May I ask for help?
I am using Windows 7 and Powershell 5.1.14409.1005
Error I receive when running example from Microsoft page (New-GPO -Name TestGPO -Comment "This is a test GPO."):
It is actually extremely simple, but the organization of the modules and features has changed many times in the past ten years, Microsoft Docs don't document the up-to-date way anywhere and all articles found online are very old.
Anyway, to install the Powershell Module called GroupPolicy, you need to install the Windows Feature called GPMC (Group Policy Management Console) which includes the mentioned module.
Install-WindowsFeature GPMC
This feature was once a subfeature of the RSAT feature, which is the cause of confusion.
Step 1. Install RSAT from Microsoft site:
https://www.microsoft.com/en-in/download/details.aspx?id=7887
Step 2. Enable Group Policy from Windows Features.
Following link describes the steps in details:
https://www.powershellmagazine.com/2012/05/14/managing-group-policy-with-powershell
Have you installed the RSAT (Remote Server Administration Tools) Group Policy component?

Managing windows hosts with Ansible. "winrm or requests is not installed."

I'm currently setting up Ansible on CentOS7 and I need to use it to manage some Windows machines.
I was following these two guides (1 & 2) to get this set up.
When running the command ansible host_group -i hosts -m win_ping
I get back an error saying:
x.x.x.x | FAILED! => {"msg": "winrm or requests is not installed: No module named xmltodict"}
I checked my installed python modules and I have both winrm and requests
I'm not sure what I'm missing here. There was a post I found on the RedHat forums outlining the same problem https://access.redhat.com/solutions/335668
Thanks for your time
EDIT: I also have xmltodict installed.
You sure you have then install in the right version of python 2 vs python 3? Had similar issues before, installing with both pip and pip3 fixed it.

How do I remove Python installations with PowerShell Package Management?

I want to write a script which cleans up all existing versions of Python on a machine, and a separate script to re-install both versions 2.7 and 3.5 in standardized locations. I'm currently trying to do this using the Package Management cmdlets in PowerShell 5.1.14393.187.
For the cleanup script, I started with PowerShell's package commands:
Get-Package "*python*" | Uninstall-Package
Which, when run from an admin console, seems to work nicely, but on further investigation leaves some packages remaining...
PS C:\WINDOWS\system32> Get-Package "*python*"
Name Version Source ProviderName
---- ------- ------ ------------
Python 3.5.1 (64-bit) 3.5.1150.0 Programs
Python 3.5.1 pip Bootstrap ... 3.5.1150.0 msi
Python 3.5.1 Tcl/Tk Support... 3.5.1150.0 msi
Python 2.7.11 2.7.11150 msi
Python 3.5.2 pip Bootstrap ... 3.5.2150.0 msi
Python 3.5.2 (32-bit) 3.5.2150.0 Programs
Why are these packages still present after Uninstall-Package? Is there a best-practice way to do this? Is there a best-practice way to script Python's re-installation so this won't happen again?
Update
I've had some success in cleaning up the majority of this by using the control panel GUI to first repair and then uninstall the Python 3 installations. I'm surprised there is no Repair-Package command to go with Get-Package.
Once the other parts of Python 3 were repaired, there was one MSI package called "Python Launcher", and the Python 2.7 MSI package remaining reported by Get-Package, but nothing in the GUI. At this point Uninstall-Package on the "Python Launcher" succeeded with a warning that a reboot was required. No such luck with msi:Python 2.7.11/2.7.11150.
Additional information:
I think Chocolatey v0.10.1 may have contributed to the current situation. At least some of the machines may have had python installed using chocolaty from the public repository. On the same machine above, I've also tried this:
PS C:\WINDOWS\system32> choco uninstall python
Chocolatey v0.10.1
Uninstalling the following packages:
python
python is not installed. Cannot uninstall a non-existent package.
Chocolatey uninstalled 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
- python - python is not installed. Cannot uninstall a non-existent package.
Did you know the proceeds of Pro (and some proceeds from other
licensed editions) go into bettering the community infrastructure?
Your support ensures an active community, it makes you look smarter,
plus it nets you some awesome features!
https://chocolatey.org/compare
PS C:\WINDOWS\system32> choco uninstall python3
Chocolatey v0.10.1
Uninstalling the following packages:
python3
python3 v3.5.1
Skipping auto uninstaller - No registry snapshot.
python3 has been successfully uninstalled.
Chocolatey uninstalled 1/1 packages. 0 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\WINDOWS\system32> choco uninstall python2
Chocolatey v0.10.1
Uninstalling the following packages:
python2
python2 v2.7.11
Running auto uninstaller...
Skipping auto uninstaller - The application appears to have been uninstalled already by other means.
python2 has been successfully uninstalled.
Chocolatey uninstalled 1/1 packages. 0 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\WINDOWS\system32> get-package "*python*"
Name Version Source ProviderName
---- ------- ------ ------------
Python 3.5.1 (64-bit) 3.5.1150.0 Programs
Python 3.5.1 pip Bootstrap ... 3.5.1150.0 msi
Python 3.5.1 Tcl/Tk Support... 3.5.1150.0 msi
Python 2.7.11 2.7.11150 msi
Python 3.5.2 pip Bootstrap ... 3.5.2150.0 msi
To answer this question I'm going to highlight a couple of points for you to consider.
Until official support has been announced, don't use the non-official PowerShell PackageManagement provider for Chocolatey. It is an unsupported preview subject to bugs and security flaws (it was also not created by the Chocolatey team). Instead use choco.exe, or another official provider.
AutoUninstaller is the resource in official Chocolatey clients that can remove natively installed software from packages that do not contain an uninstall script. It's important to note that you also need to install from those official clients. More information at https://chocolatey.org/docs/commands-uninstall
Why are these packages still present after uninstall-package?
It really depends on what you used to install the packages and whether Chocolatey was able to capture a snapshot for auto uninstaller.
Many packages do not require an uninstall script. Some do. When they are an MSI and are upgraded outside of Chocolatey (like Chrome does automatically), you either need Package Synchronizer or an uninstall script to uninstall the software.
Is there a best-practice way to do this?
If this is for organizational use, and you have a low tolerance for breakages, we recommend you build your own internal packages. Then you can completely control the process and have a repeatable, reliable process. This is how hundreds of organizations that use Chocolatey currently have enhanced their installation processes. They typically already have software installers already present on some internal file share and build packages around them to take advantage of better automation processes (versus old batch files they may have been using, or worse, manually installing from).
If you are curious on why you should build your own, see https://chocolatey.org/docs/community-packages-disclaimer (it attempts to highlight the issues with a public repository and it being subjected to distribution rights, something an internal repository is not subject to).
Is there a best-practice way to script python's re-installation so this won't happen again?
Use a configuration management tool like Puppet, Chef, Ansible, or DSC with the Chocolatey provider. https://chocolatey.org/docs/features-infrastructure-automation
This is how you create automation across all of your machines and take advantage of package management.