Chocolatey Installation Process Logging
-
@scottalanmiller said in Chocolatey Installation Process Logging:
Doesn't work on Windows 7, no Invoke-Expression
You will have install the latest Windows Management Framework.
https://docs.microsoft.com/en-us/powershell/wmf/readme -
@scottalanmiller said in Chocolatey Installation Process Logging:
Doesn't work on Windows 7, no Invoke-Expression
Specifically Windows 7 limitation, or it doesn't work on certain versions of PowerShell?
We have a bunch of Windows 7 machines running PS 5.1.
-
Verified that Chocolatey has in fact installed on Windows 7 using that PowerShell script (using Invoke-Expression).
So it's something else stopping the install.
On one particular Win7 machine, it is running PowerShell 5.1 (which that itself requires the updated WMF).
So back to the question, how do I get the output of the Chocolatey install to append to a log file?
-
@tim_g Chocolatey normally logs itself. Is something wrong with that log?
-
@tim_g said in Chocolatey Installation Process Logging:
@scottalanmiller said in Chocolatey Installation Process Logging:
Doesn't work on Windows 7, no Invoke-Expression
Specifically Windows 7 limitation, or it doesn't work on certain versions of PowerShell?
We have a bunch of Windows 7 machines running PS 5.1.
The version of PS on Windows 7 by default lacks that command.
-
@scottalanmiller said in Chocolatey Installation Process Logging:
@tim_g said in Chocolatey Installation Process Logging:
@scottalanmiller said in Chocolatey Installation Process Logging:
Doesn't work on Windows 7, no Invoke-Expression
Specifically Windows 7 limitation, or it doesn't work on certain versions of PowerShell?
We have a bunch of Windows 7 machines running PS 5.1.
The version of PS on Windows 7 by default lacks that command.
Yes a lot of great stuff is lacking in old PS versions. That's why it's good to keep systems up to date with things like PowerShell. It helps with so much.
-
@jaredbusch said in Chocolatey Installation Process Logging:
@tim_g Chocolatey normally logs itself. Is something wrong with that log?
It's not getting that far. No
c:\programdata\chocolatey
which is where the log would be. -
@tim_g said in Chocolatey Installation Process Logging:
@jaredbusch said in Chocolatey Installation Process Logging:
@tim_g Chocolatey normally logs itself. Is something wrong with that log?
It's not getting that far. No
c:\programdata\chocolatey
which is where the log would be.Why are you using your own made up command to run the install?
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
-
@jaredbusch said in Chocolatey Installation Process Logging:
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
iex
is an alias toInvoke-Expression
@jaredbusch said in Chocolatey Installation Process Logging:
Set-ExecutionPolicy Bypass -Scope Process -Force;
I don't need this part, because it's running as a computer startup script via Group Policy.
@jaredbusch said in Chocolatey Installation Process Logging:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
So, it's the same thing... nothing made up, you just give me the exact same thing I'm already doing.
-
Wait.. I thought Invoke-Expression has existed for a long time..
It is Invoke-WebRequest that was in Powershell3+
-
Does the Chocolatey installer grab anything from anywhere other than *.chocolatey.org?
-
@tim_g said in Chocolatey Installation Process Logging:
Does the Chocolatey installer grab anything from anywhere other than *.chocolatey.org?
No. You can look in the script to see that.
-
[jbusch@dt-jared ~]$ grep http install.ps1 # at https://github.com/chocolatey/chocolatey.org # http://www.apache.org/licenses/LICENSE-2.0 $url = "https://chocolatey.org/api/v2/package/chocolatey/$chocolateyVersion" # http://www.leeholmes.com/blog/2008/07/30/workaround-the-os-handles-position-is-not-what-filestream-expected/ plus comments Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to do one or more of the following: (1) upgrade to .NET Framework 4.5+ and PowerShell v3, (2) specify internal Chocolatey package location (set $env:chocolateyDownloadUrl prior to install or host the package internally), (3) use the Download + PowerShell method of install. See https://chocolatey.org/install for all install options.' $url = 'https://chocolatey.org/api/v2/Packages()?$filter=((Id%20eq%20%27chocolatey%27)%20and%20(not%20IsPrerelease))%20and%20IsLatestVersion' Download-File 'https://chocolatey.org/7za.exe' "$7zaExe" [jbusch@dt-jared ~]$
-
Well I figured out the issue preventing the install of Chocolatey.
It was because these specific machines are on an off-internet network, and were also NOT connecting through a proxy server.
After applying a .reg file to set the computer to use the proxy server, Chocolatey installed, and therefore salt-minion installed, too, (after whitelisting .saltstack.com on the proxy servers). I entered a pssession on the machine and seen that Chocolatey installs salt-minion from the saltstack.com repo. All is well now, so long as off-internet computers are using a proxy server.
Script log file:
2018-03-23 11:18:52 Checking for Salt Minion process. 2018-03-23 11:18:52 Salt Minion is NOT running. Attempting to start. 2018-03-23 11:18:52 Salt Minion executable is missing. Can't start. 2018-03-23 11:18:52 Salt Minion is still NOT running. Attempting to reinstall Salt Minion and Chocolatey. 2018-03-23 11:18:52 Checking for Salt Minion process after reinstall attempt. 2018-03-23 11:18:52 Salt Minion is still NOT running. Reinstall FAILED. 2018-03-23 11:18:52 Email sent to ****@****.com - Salt Minion reinstall FAILED on ****03 2018-03-23 11:18:52 Checking if Chocolatey is functional. 2018-03-23 11:18:52 Chocolatey is functional. 2018-03-23 11:23:50 Checking for Salt Minion process. 2018-03-23 11:23:50 Salt Minion is NOT running. Attempting to start. 2018-03-23 11:23:50 Salt Minion executable is missing. Can't start. 2018-03-23 11:23:50 Salt Minion is still NOT running. Attempting to reinstall Salt Minion and Chocolatey. 2018-03-23 11:23:50 Checking for Salt Minion process after reinstall attempt. 2018-03-23 11:23:50 Salt Minion is running. Reinstall successful. 2018-03-23 11:23:50 Email sent to ****@****.com - Salt Minion reinstall successful on ****03 2018-03-23 11:23:50 Checking if Chocolatey is functional. 2018-03-23 11:23:50 Chocolatey is functional.
However, I still would like to know how to have the Chocolatey installer append it's install status to a log file from my script.