The ability to find and install PowerShell modules from online sources like Nuget makes life for a Windows admin a smidge nicer. On the flipside, arbitrary trust of online package repositories and granting servers outbound internet access can be a nightmare for those tasked with protecting a network.
You might find yourself needing to install a PowerShell module (as a nupkg file) on a system with restricted (or no) internet access, as one of our security consultants found himself needing to do.
Here’s a quick guide on how to achieve this. If only it were as simple as an Install-Package .\module.nupkg!
Offline .nupkg installation
Install-PackageProvider -Name NuGet -RequiredVersion 220.127.116.11 -Force to install the provider from a computer with an internet connection.
- After the install, you can find the provider installed in C:\Program Files\PackageManagement\ProviderAssemblies – copy the Nuget folder to external media or otherwise find a way to get it to your target system.
- Place the nuget folder in C:\Program Files\PackageManagement\ProviderAssemblies on your target computer.
- Start a new PowerShell session on the target computer to auto-load the package provider.
- Create a new folder in C:\ named Packages
- Copy your nupkg file(s) into C:\Packages
- In PowerShell run
Register-PSRepository -Name Local -SourceLocation C:\Packages -InstallationPolicy Trusted
- You can list the packages available with
Find-Module -Repository Local
Install-Module -Name <YourModuleName> where
<YourModuleName> is the name of your package as returned by the command in step 8.
I put this together with information from trebleCode and Nova Sys Eng in this StackOverflow thread. Thanks go out to those fine people.
Here’s a stupid script I made to export PHP IPAM to an Excel XLS, then email it to someone.
Edit the ipamexport.sh file to specify the URL and desired email recipient.
Edit the mailer.py file to specify your SMTP server and sender address.
Pop it in a crontab for scheduled exports.
You can review the source in my GitHub.
Screw paying for CDs on eBay.
Here’s a link to the D22 Service Manual covering models from ’97 to early ’08.
Click read more to get the link.
Had this error occur in my Hyper-V lab after playing with WinRM GPOs. After removing the GPO because SCVMM is a finicky pain – I was still receiving this error when attempting to create a new VM:
An internal error has occurred trying to contact the lab-hyperv1.lab.int server: : .
WinRM: URL: [http://lab-hyperv1.lab.int:5985], Verb: [INVOKE], Method: [CreateDirectory], Resource: [http://schemas.microsoft.com/wbem/wsman/1/wmi/root/scvmm/FileInformation]
Invalid Signature (0x80090006)
Check that WS-Management service is installed and running on server lab-hyperv1.lab.int. For more information use the command "winrm helpmsg hresult". If lab-hyperv1.lab.int is a host/library/update server or a PXE server role then ensure that VMM agent is installed and running. Refer to http://support.microsoft.com/kb/2742275 for more details.
Here’s how to fix this:
- Remove the affected Hyper-V hosts from SCVMM
- Open Certificate Management (Computer) and make sure you don’t see certificates for the Hyper-V hosts in the ‘Trusted People’ store
- Re-add the Hyper-V hosts
You should now be able to create new VMs.
Back in the day, when mIRC and NoNameScript were my friends, I used to have a CTCP trigger set up that gave people DCC leeching from me the ability to resume transfers if they disconnected for some reason, amongst other things.
Now that I’m all Mac, I’ve been using Colloquy, and haven’t started looking at scripting for it – that is, until today.
Austnet are now blocking all DCC by default, and the only way to allow someone to send you a file is to issue the user command /dccallow +User <timeout> – adding them to a temporary Allow list. This, of course, only works if your nick is registered and you have identified with /nickop.
Place this script in your ~/Library/Application Support/Colloquy/Plugins directory, then issue a /reload plugins in Colloquy if it’s already open. People can then use /ctcp <Your Username> DCCALLOW to allow themselves DCC access to your username for 300 seconds. Additionally, if you want to auto-accept DCC requests from strangers, you’ll need to modify your Colloquy settings to allow it.