Skip to content

Instantly share code, notes, and snippets.

View dotps1's full-sized avatar

Thomas Malkewitz dotps1

View GitHub Profile
@dotps1
dotps1 / Get-SqlEdition.ps1
Last active August 29, 2015 13:56
Gets SQL Edition Type for each installed SQL Instance
<#
.SYNOPSIS
Collects each SQL Edition Type by Instance Name.
.DESCRIPTION
Enumerates the registry for installed instances of SQL, then foreach installed instance, it enumerates the Edition Type.
.EXAMPLE
Get-SqlEdition -ComputerName MySQLServer.mydomain.org
.EXAMPLE
@("MyComputer","MyServer","MyDomainController") | %{ Get-SqlEdition -ComputerName $_ }
.NOTES
@dotps1
dotps1 / New-RandomPassword.ps1
Last active April 30, 2025 17:42
Create a new random password with powershell, specify length, upper case, lower case, numbers, symbols. all are ASCII mapped arrays.
<#
.SYNOPSIS
Creates random password string of length 1 to 100.
.DESCRIPTION
Creates random password with ability to choose what characters are in the string and the length, the symbols can be specificlly defined.
.EXAMPLE
New-RandomPassword -Length 8 -Lowercase
In this example, a random string that consists of 8 lowercase charcters will be returned.
.EXAMPLE
New-RandomPassword -Length 15 -Lowercase -Uppercase -Numbers -Symbols
@dotps1
dotps1 / Export-AclToCsv.ps1
Last active January 5, 2024 08:22
Formats some acl properties to nice, readable csv columns.
<#
.SYNOPSIS
Gets useful ACL properties and exports them to a CSV file.
.DESCRIPTION
Gets Path, Owner, Access, Inheritance, and InheritanceFlags of an object(s) and export them to a CSV.
The CSV format is desinged for user firendly read-ablitly.
The first two columns of a row will be Path and Owner, then the next row(s) will be the Identity and Permissions of the left most object.
Once the next object is enumerated, the Path and Owner will begin on the left most column.
Example Output of 'Export-AclToCsv -Path "\\Server\Share" -ExportPath $env:HOMEPATH + "\test.csv":
@dotps1
dotps1 / Get-UnEncryptedWorkstationsFromCMDB.ps1
Last active August 29, 2015 13:56
Querys CCM CM_<SiteCode> Database and return unecrypted computers. BitLockerStatus needs to be set to inventoried in the client settings to populate the table being queried.
<#
.SYNOPSIS
Queries ConfigMgr Database for BitLockerProtectionStatus Boolean Value.
.DESCRIPTION
Queries ConfigMgr Database for any workstation that has completed a Hardware Inventory Scan, looks for the BitLockerProtectionStatus Value, 1 is fully encrypted and Protection is on, 0 for anything else.
Also uses the inventoried file: 'Orginal System Loader' which is used by TrueCrypt to indicate full disk encryption.
.EXAMPLE
Get-UnEncryptedWorkstationsFromCMDB
.EXAMPLE
Get-UnEncryptedWorkstationsFromCMDB -SqlServer localhost -Database ConfigMgr -IntergratedSecurity
@dotps1
dotps1 / Get-ADInactiveWorkstations.ps1
Last active January 5, 2024 08:22
I know this script can be found in a billion different places, but i wanted to turn it into a cmdlet, so here it is. the 'OU' Param will default to the root of the current domain, so be careful if you have hundereds of workstations that have not logged on in long time. Enjoy
<#
.SYNOPSIS
Queries AD DS for workstation accounts that have not logged in for a given amount of time.
.DESCRIPTION
Queries AD DS in spcific OU and uses the LastLogonTimeStamp to determine the last time a computer account has logged on.
The Default Value of is 180 for days a computer account is inactive.
The Default Value of the SearchBase is the root of the domain of the currently logged on user.
.EXAMPLE
Get-ADInactiveWorkstations
In this example, all workstations that have not logged on within 180 days from the root of the current users domain will be returned.
@dotps1
dotps1 / GetSet-DiskTimeoutValue.ps1
Last active January 5, 2024 08:22
GetSet-DiskTimeoutValue
<#
.SYNOPSIS
Gets the current value for the Disk TimeoutValue from the registry of a machine.
.DESCRIPTION
Gets the value that is currently set in the registry for the time out a disk waits before timing out and shuting down a system.
.EXAMPLE
Get-DiskTimeoutValue
.EXAMPLE
Get-DiskTimeoutValue -ComputerName MyServer.mydomain.org
.EXAMPLE
@dotps1
dotps1 / Set-CitrixReciverSSON.ps1
Last active August 29, 2015 14:00
Set the default method for Citrix Reciver to use Pass-Through Authentication first.
<#
.SYNOPSIS
Sets Single Sign On Option as the default sign on method to Pass-Through Authentication.
.DESCRIPTION
Exports the Configuration Model 000 Registry Binary Key.
Converts the Binary to ASCII and then to an Xml Object.
Using the Xml Class Methods, it modifes the 'LogonMethod' Value to 'sson'.
If the 'LogonMethod' Node does not exist, it will be created and the Value set to 'sson'.
Commits the changes, if there where any back to the registry.
.EXAMPLE
@dotps1
dotps1 / Update-NetworkPrinterServerConnection.ps1
Last active June 22, 2022 08:26
Migrate Network Printer from one PrintServer to another. Requires PowerShell v2.
<#
.SYNOPSIS
Migrates network printers from one print server to another.
.DESCRIPTION
Migrates all networked printers from one specified print server to another print server.
.EXAMPLE
Update-NetworkPrintersServerConnection -OldPrintServer "\\MyOldPS" -NewPrintServer "\\MyNewPS"
.NOTES
This is done with a ComObject allowing for use in PowerShell V2, before the Get-Printer,Add-Printer and Remove-Printer Cmdlets where introduced.
http://technet.microsoft.com/en-us/library/dd347648.aspx
@dotps1
dotps1 / Convert-MACAddressDelimiter.ps1
Last active August 29, 2015 14:02
Convert or remove the delimiter in a MAC Address String.
function Convert-MACAddressDelimiter
{
[CmdletBinding()]
[OutputType([String])]
Param
(
[Parameter(Position = 0,
Mandatory = $true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true)]
<#
.SYNOPSIS
Renames a Domain Computer to its Serial Number.
.DESCRIPTION
Connects to the Win32_Bios Wmi Class and retrieves the Serial Number, if the existing computer name does not match the serial number, it will be renamed.
.EXAMPLE
Reanme-DomainComputerToSerialNumber -ComputerName "MyComputer.mydomain.org" -Restart
.EXAMPLE
$cred = Get-Credential; @("ComputerA","ComputerB","ComputerC") | Reanme-DomainComputerToSerialNumber -DomainCredential $cred -Restart
.NOTES