Skip to content

Instantly share code, notes, and snippets.

View ZJPat's full-sized avatar

ZJP ZJPat

  • Washington, DC
View GitHub Profile
If (${env:ProgramFiles(x86)}) {
$uninstallpaths = Get-ChildItem -Path ${env:ProgramFiles(x86)}, $env:ProgramFiles -Recurse -Filter uninstall.exe | Where-Object {$_.fullname -like "*teamv*"} | Select-Object -expandproperty fullname
}
Else {$uninstallpaths = Get-ChildItem -Path $env:ProgramFiles -Recurse -Filter uninstall.exe | Where-Object {$_.fullname -like "*teamv*"} | Select-Object -expandproperty fullname}
If ($uninstallpaths) {
foreach ($uninstallpath in $uninstallpaths) {
Start-Process cmd -ArgumentList "/C `"$uninstallpath`" /S" -Wait
}
}
$NumDays = 0
$LogDir = ".\AD-Accounts.csv"
$currentDate = [System.DateTime]::Now
$currentDateUtc = $currentDate.ToUniversalTime()
$lltstamplimit = $currentDateUtc.AddDays(- $NumDays)
$lltIntLimit = $lltstampLimit.ToFileTime()
$adobjroot = [adsi]''
$objstalesearcher = New-Object System.DirectoryServices.DirectorySearcher($adobjroot)
$objstalesearcher.filter = "(&(objectCategory=person)(objectClass=user)(lastLogonTimeStamp<=" + $lltIntLimit + "))"
function Set-ComputerName {
param( [switch]$help,
[string]$CurrentPCName=$(read-host "Please specify the current name of the computer"),
[string]$computerName=$(read-host "Please specify the new name of the computer"))
$usage = "set-ComputerName -CurrentPCname CurrentName -computername AnewName"
if ($help) {Write-Host $usage;break}
$computer = Get-WmiObject Win32_ComputerSystem -CurrentPCname CurrentName -computername $currentPCName
$computer.Rename($computerName)
FAULTING_IP:
+8d8ee91ba0
00000000`00000000 ?? ???
EXCEPTION_RECORD: ffffffffffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 0000000000000000
ExceptionCode: 80000007 (Wake debugger)
ExceptionFlags: 00000001
NumberParameters: 0