Powershell comes with a handy little cmdlet to download files from the internet called Invoke-WebRequest which is documented at https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.2. There’s an alias for it so it can be called as just iwr. Let’s say there’s a file at https://pathtothefile/myfile.txt and we want to download it to the working directory as simply myfile.txt. That could be done with the following command: iwr -uri https://pathtothefile/myfile.txt -OutFile ./myfile.txt -UseBasicParsing -UseDefaultCredentials In the above example, we used the -uri to identify the target resource and -OutFile to list the local location. The above command used basic parsing as we were accessing a resource from an older server, although that wouldn’t be required for…
-
-
VMS
-
The History Of Microsoft Windows 1.0
-
Get A List Of Software Installed On Windows And Uninstall Software Using Powershell
The Get-AppxPackage cmdlet can be used to obtain a list of all apps installed on a Windows host. In the following example, we’ll look at the apps installed for all users using the -AllUsers option. Get-AppxPackage -AllUsers The output includes a Name, the name of the publisher, along with a location, the architecture, the version, the full name, the status, whether the software is signed, whether the development mode is enabled (useful when testing), the id of the publisher, the family, etc. Next we’ll do a Select against the found set. You can use so stdout displays the Name and the unique identifier, which we can then use to programmatically…
-
Quick And Dirty Windows Firewall Scripting
Here ya’ go! netsh advfirewall firewall add rule name=”KryptedWebhook” dir=in protocol=tcp localport=8443 profile=private remoteip=any action=allow Wait, what’s that?!?! Let’s break down the options I used here: advfirewall: Yup, it’s the new firewall. firewall: Yup, it’s a firewall. add: I’m adding a new rule. I also could have used delete along with the rule name and removed one. Or show to see one. Or set to augment one. rule: It’s all about rules. Each rule allows for a port and/or an action. name: Every rule needs a unique name. Namespace conflicts will result in errors. If programmatically creating rules, I’ve found it undesirable to use a counter and instead moved to…
-
Remotely and Silently Install A Windows MSI Via PowerShell
One of the easiest things to do in OS X is to remotely run an installation package using the installer command. You can do some similar tasks in Windows, although the commands aren’t quite as cut and dry. The Start-Process command can be used to kick off an executable. Here, we will kick off the msiexec.exe and feed it an argument, which is the msi file to install silently. We’ll then wait for it to complete: {Start-Process -FilePath "msiexec.exe" -ArgumentList "/i TEST.msi /qb" -Wait -Passthru}
-
Package Manager Like apt-get For Windows 10
In Windows 10, Microsoft has finally baked a package manager called OneGet into Windows. It works similarly to apt-get and other package managers that have been around for decades in the Linux world; just works in PowerShell, rather than bash. So let’s take a quick peak. First, import it as a module from a PowerShell prompt: Import-Module -Name OneGet Next, use Get-Command to see the options for the OneGet Module: Get-Command -Module OneGet This will show you the following options: Find-Package Get-Package Get-PackageProvider Get-PackageSource Install-Package Register-PackageSource Save-Package Set-PackageSource Uninstall-Package Unregister-PackageSource Next, look at the repositories of package sources you have: Get-PackageSource You can then add a repo to look at,…
-
Yosemite Server SMB and Windows
A few people have hit me up about issues getting Windows machines to play nice with the SMB built into Yosemite Server and Windows. Basically, the authentication dialog keeps coming up even when a Mac can connect. So there are two potential issues that you might run into here. The first is that the authentication method is not supported. Here, you want to enable only the one(s) required. NTLMv2 should be enabled by default, so try ntlm: sudo serveradmin settings smb:ntlm auth = "yes" If that doesn’t work (older and by older I mean old as hell versions of Windows), try Lanman: sudo serveradmin settings smb:lanman auth = “yes" The second…
-
Use Syslog on Windows
There are a number of tools available for using Syslog in a Windows environment. I’ll look at Snare as it’s pretty flexible and easy to configure. First download the snare installation executable from http://sourceforge.net/projects/snare. Once downloaded run the installer and simply follow all of the default options, unless you’d like to password protect the admin page, at which point choose that. Note that the admin page is by default only available to localhost. Once installed, run the “Restore Remote Access to Snare for Windows” script. Then open http://127.0.0.1:6161 and click on Network Configuration in the red sidebar. There, we can define the name that will be used in syslog (or leave…
- Active Directory, Mac OS X, Mac OS X Server, Microsoft Exchange Server, Network Infrastructure, Ubuntu, Unix, VMware, Windows Server
Stashbox: Turning a Mac Mini Into A Logstash and Kibana Server
You have a lot of boxes. You would like to be able to parse through the logs of all those boxes at the same time, searching for a given timestamp across a set of machines for a specific string (like a filename or a port number). elasticsearch, logstash and kibana are one way to answer that kind of need. This will involve downloading three separate packages (which for this article, we’ll do in /usr/local) and creating a config file. First, install the latest Java JDK. This is available at jdk8-downloads-2133151.html. The following is going to download the latest version of logstash and untar the package into /usr/local/logstash (I like nesting…