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, October 13, 2021

WSUS Part 2: Create a task for Patch Tuesday with Powershell

I found out that it is not possible to choose a monthly schedule on the second tuesday of the month with "New-ScheduledTaskTrigger". It is only possible to use a monthly or weekly schedule. Because of this, I used SCHTASKS to create a task for my WSUS PowerShell scripts:

For more information about "New-ScheduledTaskTrigger":


Wednesday, October 6, 2021

WSUS Part 1: Synchronization updates and Approve/Deny updates with Powershell

You can use PowerShell for WSUS management. This example works on a Windows Server with Powershell 5.1 and the Powershell WSUS module installed from Server Manager. You can start the synchronization and approve the updates with the example below:

You can use this example if you like to deny older updates:

All updates are denied when they are older then 4 months.

Sometimes it is necessary to accept a license agreement for an update. You can use this code to accept all license agreements:

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:




Thursday, September 23, 2021

Restore a file with Powershell

Did you delete the wrong file? Need to restore an accidentally deleted file? This Powershell Module
can be the solution:

PowerForensics


PowerForensics is a free Powershell module for forensic research with Powershell. You can use this module for restoring deleted files. Of course there is no guarantee that you can restore it, but you can try it. Check this nice tutorial:

How to Recover Deleted Files from the Drive? | CQURE Academy



Thursday, September 2, 2021

How to create an ISO with Powershell

I don't like to install ISO creation software on every jump or management server. I use a script from this website:


The code is easy to copy to a server in a RDP session or copy a PS1 file to a share and you can run on the server. You don't need any additional modules.


Sunday, August 29, 2021

PowerShell: Download updates from the Microsoft Update Catalog

Download updates from the Microsoft Update Catalog

Most administrators use WSUS for deploying updates on a network. But sometimes it is useful to download stand-alone updates from the Microsoft Update Catalog. I found this PowerShell module:

 https://github.com/ryan-jan/MSCatalog

It is regularly updated and works fine for me. Soon I will post some examples.

Sunday, June 10, 2018

Powershell and System.IO.FileSystemWatcher

I have used FileSystemWatcher for a few script to monitor the filesystem. It is working correct. Only haeavy loads can be a problem because of a buffer overrun. A few useful tutorials I used:

https://mcpmag.com/articles/2015/09/24/changes-to-a-folder-using-powershell.aspx

http://www.mobzystems.com/code/using-a-filesystemwatcher-from-powershell/

Some more information about de buffersize:

https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.internalbuffersize(v=vs.110).aspx


Saturday, June 9, 2018

Microsoft: Windows 10 version 1803 - Broken Policies

Windows 10 version 1803 has some problems with policies. Keys locations or values are changed. So if something is broken, check your policies and de keys they change. I found an example of one of them here:


Microsoft broke "disable web search" in Windows 10 version 1803

Windows 10 users and administrators who plan to upgrade devices running the operating system to Windows 10 version 1803, the Spring Creators Update, need to be aware that certain policies are broken currently in the new version of Windows 10.
In particular, the policy "Do not allow web search" has no effect when enabled on the device. The initial version of Windows 10 combined local search functionality with web search functionality when it came out.
Search results displayed local results, for example files or preferences that match the search term, and suggested web search results. These suggestions were pulled from Bing and loaded the results page on Bing in Microsoft Edge when selected.
Another problem I found was with the site list in Edge to open websites with IE 11:
I don't have a solution yet, but it is a problem with the changed policies.

Monday, December 25, 2017

Permissions and user rights for IIS 7.0 and later..



This is useful information for IIS servers:

Specify an Identity for an Application Pool (IIS 7)
Read more about  Identities in IIS here..

Default permissions and user rights for IIS 7.0 and later 
Read more about default permissions here..

Understanding Built-In User and Group Accounts in IIS 7
Read more about Built-In user and Group Accounts here..

Wednesday, December 6, 2017

New on Vice: Season 2 of Cyberwar

There is a new season of Cyberwar on Viceland.com:

https://www.viceland.com/en_us/show/cyberwar

Ben Makuch travels the world to meet with hackers, government officials, and dissidents to investigate the ecosystem of cyberwarfare.

Monday, December 4, 2017

Powershell: Counter with speech



This is a basic counter with speech:

# Making a speech object:
Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer

# The counter with speech:
$i = 0 
while( $i -le 100){
  $speak.Speak($i)
  $i++
}


Friday, December 1, 2017

Get Bitcoin Price with Powershell

With this function you can get the Bitcoin price as a string value or spoken with Powershell

function Get-BitcoinPrice{

    param (
    [Boolean]$Speech = $false
    )
    
    #Get the current price from coinmarketcap.com
    $content = Invoke-WebRequest -uri https://api.coinmarketcap.com/v1/ticker/bitcoin/
    
    #Select the price from the content
    $found = $content.Content -match "price_usd`": `"(?<price>.*)`"," 

    $price = $matches['price'].ToString()

    #If the parameter -Speech is $true, then you can hear a voice saying the price.
    if($Speech -eq $true){
        Add-Type -AssemblyName System.speech
        $speak = New-Object System.Speech.Synthesis.SpeechSynthesizer

        $speak.Speak("Bitcoin price is $price")
    }

    #The price is returned for future usage.
    Return $price
}

Get-BitcoinPrice -Speech $true

# or

Get-BitcoinPrice

Tuesday, March 28, 2017

vSphere Server Appliance 6.5: Could not connect to one or more vCenter Server systems: https://:443/sdk


Do you get the next error in vSphere Web Client 6.x?:

Could not connect to one or more vCenter Server systems:
https://<IP-adres or FQDN>:443/sdk

If you open the URL, you get this error:

503 Service Unavailable (Failed to connect to endpoint: [N7Vmacore4Http16LocalServiceSpecE:0x00007f24400047c0] _serverNamespace = /sdk action = Allow _port = 8085)

Are you using the appliance? My problem was solved by the next solutions:

Source: https://communities.vmware.com/thread/547345

I seem to have fixed my issue by simply typing in a System name in the dialogue pictured below, instead of leaving it blank, which relied on the DHCP reservation/DNS entry in my router that worked under 6.0U2.

I've now survived 5 ESXi reboots, using ESXi host reboot, which was set to shut down all VMs gracefully, and to restart VCSA automatically.

I will continue to test and reboot, but first, a flight to catch, with my server onboard, of course ;-)

Here's how I was doing 6.0U2 or 6.5 installs, choosing DHCP, and leaving System name blank (but setting up a DHCP reservation for the VM's MAC address, and setting up a DNS name, by suspending the VCSA 6.5 appliance moments after the power up button appears, and grabbing the fresh  VM's MAC, then resuming)


  





















I don't use DDNS:


  but figured I'd try to put in a System name anyway:



 Five reboots later, I seem to be good, used to fail on first or second reboot/restart of VCSA.

More information:

Friday, March 24, 2017

VMware vSphere Essentials V6 - Migrating storage tip.

The migration option "Change storage only" is not allowed in VMware vSphere Essentials.

If you want to migrate a VM storage from one datastore to another, then use "Change both compute resource and storage".

After the migration is completed, use "Change compute resource only"option to migrate the VM back to his original host.

This way you can live migrate the storage of you VM. It takes more time and work, but the VM stays online.

Wednesday, March 15, 2017

Browsing anonymously the internet


There a many ways to browse anonymously. Each option has his own advantages and disadvantages.

Networks:

https://www.torproject.org/

From the official website:
Tor is free software and an open network that helps you defend against traffic analysis, a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security.

It has his own network and browser based on Firefox. It uses different end nodes during you browsing. The drawback is that some website block known end nodes or you loose functionality.

https://geti2p.net/nl/

From the offcial website:
I2P is an anonymous overlay network - a network within a network. It is intended to protect communication from dragnet surveillance and monitoring by third parties such as ISPs.
Like TOR it has his own network and applications.

Browser:

A chrome based browser with builtin protection against many tracking options:

https://www.epicbrowser.com/

Linux distribution:

This is a Linux distribution. You can boot it from USB or DVD. It uses TOR, but has some more features to protect you against tracking. It does not save any data on the hard-disk and if you shutdown the Linux OS normally, it will clear the memory.

https://tails.boum.org/

Other Solutions:

You can check the websites below for more anonymously browsing options:

https://anonymous-proxy-servers.net/

https://www.anonymizer.com/



Saturday, January 14, 2017

Free Open Source Cyber Security Learning



Yesterday I found this free and Open Source Cyber Security Learning website:

https://www.cybrary.it/

You can find many usefull courses about Cyber Securyity here. Check it out!

Tuesday, October 18, 2016

VMware Tools & SIDEBYSIDE Event ID 33

On a few VM's the VMware tools didn't work. After starting the service, I got an error. This is the error in the Event Viewer:

Activation context generation failed for “C:\Program Files\VMWareTools\plugins\vmusr\vmtray.dll”. Dependent Assembly Microsoft.VC90.MFC,processorArchitecture=”amd64″,publicKeyToken=”1fc8b3b9a1e18e3b”,type=”win32″,version=”9.0.30729.4148″ could not be found. Please use sxstrace.exe for detailed diagnosis.

The solution:

Install: 

Microsoft Visual C++ 2008 Redistributable – x86 9.0.30729.4148 (32bits)

or

Microsoft Visual C++ 2008 Redistributable – x64 9.0.30729.6161 (64bits)

For more useful information check this website:

http://vpxa.info/index.php/2016/02/16/vmware-tools-10-0-5-3227872-sydebyside-event-id-33/