Skip to content

Instantly share code, notes, and snippets.

View puttyq's full-sized avatar

Almero Steyn puttyq

  • South Africa
View GitHub Profile
@puttyq
puttyq / Tester - Service Status.ps1
Created November 18, 2021 06:07
Multi-Domain Service Enumerator
<#
.SYNOPSIS
Tester - Service Status.ps1 - Tester to check the status of all PCNSSVC services on all current domain context DCs.
.DESCRIPTION
The scripts will look for all current domain context DC and query the status of the PCNSSVC service.
Possible status messages include:
- running
- stopped
- starting
- unreachable (the server is not avaiable on the network)
@puttyq
puttyq / Resolve-DNS.ps1
Created January 24, 2020 15:26
PowerShell - Quick Domain Resolution (Resolve-DNSName)
$getdns = Get-Content .\dns.txt
$getdns | foreach {Resolve-DnsName -Type NS $_ | Where-Object -Property Type -EQ "NS" | Select Name, NameHost}
@puttyq
puttyq / ps-github-release-download.ps1
Created December 6, 2018 06:26
Simple script to download the latest GitHub release MSI file
$repo = "xxxx/xxxx"
$file = "xxxxx.msi"
$releases = "https://api.github.com/repos/$repo/releases"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$tag = (Invoke-WebRequest -Uri $releases -UseBasicParsing | ConvertFrom-Json)[0].tag_name
$download = "https://github.com/$repo/releases/download/$tag/$file"
$msi = "$name-$tag.msi"
@puttyq
puttyq / ps-sap-integration-import.ps1
Created August 3, 2018 11:38
Importing data via New-WebServiceProxy from SAP ES with PowerShell
# Create function object
$getList = New-Object SAP.BAPI_USER_GETLIST
# Create a return object
$getList.USERLIST = New-Object SAP.BAPIUSNAME
# Execute function call
$getList = $proxyUser.BAPI_USER_GETLIST($getList)
@puttyq
puttyq / ps-sap-integration-structure.ps1
Last active September 18, 2020 13:23
Using New-WebServiceProxy to connect into SAP ES via PowerShell
# Proxy variables
$username = "xxxxxxx"
$password = "*******"
$uriUserManagement = "http://servername/sap/bc/srt/wsdl/../../../../zfimconnector_user?sap-client=100"
$uriUserManagementClass = "SAP_WSDL"
$uriUserManagementNamespace = "SAP"
# Create secure credential
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
@puttyq
puttyq / ps-import-multiple-dynamic-csv-files-to-sqlserver.ps1
Created August 3, 2018 11:06
Dynamic CSV file importer (many CSV's) to SQL Server
cls
# database Details
$dbServer = "xxxxxxx"
$dbDatabaseName = "xxxxxxxx"
$dbTable = "xxxxxxxx"
# loading modules
Import-Module SQLPs
@puttyq
puttyq / ps-connect-l2tp-vpn.ps1
Created August 3, 2018 11:03
Creating and connecting to a Windows built-in L2TP VPN Connection
# Get All VPN Connections
Get-VpnConnection
# Create VPN Connection to Office L2TP
Add-VpnConnection -Name "Test" `
-ServerAddress "xxxxxxxxxx" `
-TunnelType L2TP `
-L2tpPsk "xxxxxxxxxxxx" `
-EncryptionLevel Optional `
-AuthenticationMethod MsChapv2 `
@puttyq
puttyq / ps-connect-to-sap-es.ps1
Created August 2, 2018 22:16
Connecting to SAP ES via PowerShell
# SAP proxy variables
$uriUserManagement = "http://sapserver/sap/bc/srt/wsdl/flv_10002A111AD1/bndg_url/sap/bc/srt/rfc/sap/zfimconnector/010/zfimconnector_user/zfimconnector_user?sap-client=010"
$uriUserManagementNamespace = "SAP"
$uriUserManagementClass = "SAP_WSDL"
# Create a secure credential to pass to the WS-Proxy
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential ($username, $secpasswd)
# Create web services proxy object

Keybase proof

I hereby claim:

  • I am puttyq on github.
  • I am puttyq (https://keybase.io/puttyq) on keybase.
  • I have a public key whose fingerprint is A952 74E6 207E 1BB5 424B 412D 1DEE C67C DD10 FE59

To claim this, I am signing this object: