Showing posts with label Script. Show all posts
Showing posts with label Script. Show all posts

Wednesday, December 1, 2021

Using Powershell for the FordPass API

You can use the FordPass for many models of Ford. Is it possible to use Powershell to get the battery status of a eletric car or PHEV? I found some solutions:  

clarkd/fordpass-python: Python wrapper for the FordPass API for Ford vehicle information and control: start, stop, lock, unlock. (github.com)

itchannel/fordpass-ha: Fordpass integration for Home Assistant (github.com)

Both solutions are made in Python. I like to use Powershell. So I made a early version of a script to get the battery status with Powershell:

This is the end result:


In the coming weeks I will test more options from the API and post them here.

Thursday, October 21, 2021

WSUS Part 3: Tuning you WSUS server with Powershell

WSUS Server cleanup

Because the WSUS server uses a lot of storage, it can be useful to clean the WSUS server regularly. This works well if you starts with cleaning regularly after a clean install. When you wait to long and the WSUS server becomes bigger and bigger, it will take a long time to clean the server. In PowerShell you can use this cmdlet:

Invoke-WsusServerCleanUp 

Parameters:

-CleanupObsoleteComputers

Specifies that the cmdlet deletes obsolete computers from the database.

-CleanupObsoleteUpdates

Specifies that the cmdlet deletes obsolete updates from the database.

-CleanupUnneededContentFiles

Specifies that the cmdlet deletes unneeded update files.

-CompressUpdates

Specifies that the cmdlet deletes obsolete revisions to updates from the database.

-DeclineExpiredUpdates

Specifies that the cmdlet declines expired updates.

-DeclineSupersededUpdates

Specifies that the cmdlet declines superseded updates.

-UpdateServer

Specifies the object that contains the WSUS server. This value is obtained by calling the Get-WsusServer cmdlet and passing the resulting IUpdateServer object into this cmdlet.

Example I use for my script:

Invoke-WsusServerCleanUp -CleanUpObsoleteUpdates -CleanupUnneededContentFiles -CompressUpdates


Wednesday, September 29, 2021

Password generators for Powershell

There are several ways to create a random password in your PowerShell script. 

Powershell function: 

A function to create an random password string example:


Powershell script:

You can use a this script for more advanced functions:

GitHub - PowerShell random password generator

API:

You can use an API:

GitHub - fawazsullia/password-generator

Example: