Author Archives: AnonIT

Get the command line of a running process via powershell

If you need to get the command line of a running process you can use powershell:

gwmi win32_process -filter "name='vmware-vmx.exe'" | where-object {$_.commandline -like "*ex02*"} | select commandline, processid | fl

The above will get the commandline and processid of the vmware-vmx.exe process that has a command line containing *ex02*

Create a temporary folder in powershell

I needed to create a temporary folder. I modified the code found here https://stackoverflow.com/questions/34559553/create-a-temporary-directory-in-powershell. One issue in the original code was the chance (albeit extremely slight) of having a name collision with an existing folder. The script below checks and tries 5 times before failing. It isn’t neat, and is somewhat of a brute force method of getting around the issue, but it gets the job done. You can see the modified code here https://pastebin.com/DPfj3iT7

Install Unifi Controller on Rasperry PI

Install pi
enable ssh
connect to wifi
change password
sudo apt-get install rpi-update && echo Y | sudo rpi-update
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get -y install oracle-java8-jdk
https://help.ubnt.com/hc/en-us/articles/115015026968-UniFi-Supported-Java-JRE-Version

Add unifi to sources list
echo ‘deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti’ | sudo tee -a /etc/apt/sources.list.d/100-ubnt.list > /dev/null

sudo apt-get -y install dirmngr
Add key to our raspberry pi
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv 06E85760C0A52C50
sudo apt-get update
sudo apt-get install unifi -y
sudo systemctl stop mongodb
sudo systemctl disable mongodb
sudo reboot
logon to website: https://%controllerIP%:8443

References: https://community.ubnt.com/t5/UniFi-Wireless/UniFi-Controller-5-5-on-Raspberry-Pi/td-p/2045751

Delete declined updates in WSUS

We have all seen poorly maintained WSUS servers.  This script can assist by deleting declined updates.  Combine this with a number of other methods of housekeeping on WSUS servers.

Additionally using the script we can see all the objects returned by the command $wsus.getupdates() | get-member | select name

Name
----
AcceptLicenseAgreement
Approve
ApproveForOptionalInstall
CancelDownload
CreateObjRef
Decline
Equals
ExpirePackage
ExportPackageMetadata
GetChangesFromPreviousRevision
GetHashCode
GetInstallableItems
GetLicenseAgreement
GetLifetimeService
GetRelatedUpdates
GetSummary
GetSummaryForComputerTargetGroup
GetSummaryPerComputerTargetGroup
GetSupportedUpdateLanguages
GetType
GetUpdateApprovals
GetUpdateCategories
GetUpdateClassification
GetUpdateEventHistory
GetUpdateInstallationInfoPerComputerTarget
InitializeLifetimeService
PurgeAssociatedReportingEvents
Refresh
RefreshUpdateApprovals
ResumeDownload
ToString
AdditionalInformationUrls
ArrivalDate
CompanyTitles
CreationDate
DefaultPropertiesLanguage
Description
HasEarlierRevision
HasLicenseAgreement
HasStaleUpdateApprovals
HasSupersededUpdates
Id
InstallationBehavior
IsApproved
IsBeta
IsDeclined
IsEditable
IsLatestRevision
IsSuperseded
IsWsusInfrastructureUpdate
KnowledgebaseArticles
LegacyName
MsrcSeverity
ProductFamilyTitles
ProductTitles
PublicationState
ReleaseNotes
RequiresLicenseAgreementAcceptance
SecurityBulletins
Size
State
Title
UninstallationBehavior
UpdateClassificationTitle
UpdateServer
UpdateSource
UpdateType

Create a DHCP Superscope

A transient (we were bought in to assist migration to new MSP) customer wanted to increase DHCP addresses without creating a VLAN.  They were looking at increasing their available IP addresses by about 200, and their current network was a /24 (192.168.17.0).

image

Firstly, add the new gateway IP address to the router.  In this case (on a Server 2008 Windows router), 192.168.17.1 was the original router IP, we add 192.168.18.1.

On the DHCP server, right click IPv4 and select New Scope…

Follow the wizard…

Assign the IP range to exclude and a delay if necessary

Change the default duration if necessary (default 8 days)

More than likely you will need to configure DHCP options

Add the router address as used above

Add DNS Servers in

Add WINS if necessary

Activate the scope

And click Finish

Your DHCP console should look something similar to this:

Right click on IPv4 and select New Superscope…

Click Next

Name the Superscope and click Next

image

Add the available scopes you wish to include in the Superscope and click Next

Click Finish

You should then see devices picking up an address from the 2nd scope as appropriate.

image

 

You can see more details on the Console icons here:

http://anonit.net/server-2008-r2-dhcp-console-icons-reference/

http://anonit.net/server-2003-2008-dhcp-console-icons-reference/

 

Now off to fix the next few issues at this site:

image

image

References:

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc757614(v=ws.10)

https://msdn.microsoft.com/en-us/library/dd891486.aspx