Profile cover photo
Profile photo
tony Unger
32 followers
32 followers
About
Communities and Collections
Posts

Post has attachment
Powershell : Certutil Find Expired Certs on CA server
$Before = (get-date).adddays(90).ToString("MM/dd/yyyy")
$After = (get-date).AddDays(-5).ToString("MM/dd/yyyy")
<#

https://blogs.technet.microsoft.com/poshchap/2016/01/01/powershell-and-certutil-exe/
We create a date range with
$Before, i.e. certificates ex...
Add a comment...

Post has attachment
Powershell: Generate CSR
Wrote this function to generate SAN certificate requests. <#
.Synopsis
Generate CSR by Tony Unger
.DESCRIPTION
Generates CSR
.EXAMPLE
new-csr -CommonName "test0.microsoft.comt" -DNSNames $HostNames
.EXAMPLE
new-csr -CommonName "test0.microsoft.c...
Add a comment...

Post has attachment
Set non-domain windows server to use a KMS Server
REM List out KMS Servers nslookup -type=srv _vlmcs._tcp REM Set workgroup to use a particular KMS Server slmgr.vbs /skms <KMS server>:<port>
Add a comment...

Post has attachment
Powershell: Get LUN ID with Diskspace
get-wmiobject Win32_DiskDrive | select name,caption, scsibus, scsilogicalunit, @{Name="size(GB)";Expression={"{0:N1}" -f($_.size/1gb)}} | sort-object name
Add a comment...

Post has attachment
Powershell: Change UPN on list of users
I needed a script to bulk change a list of users to a new UPN i came up with this. $Users = gc c:\temp\users.txt | get-ADUser foreach ($User in $Users){ $UserWithoutDomain = $User.UserPrincipalname $UPNUser = ([regex]::matches($UserWithoutDomain, "([^@]+)")...
Add a comment...

Post has attachment
Vmware: Powershell List all Datastores and virtual machiens within
Purpose: Need to know if i had any empty datastores attached to my ESXi hosts. Came up with this one liner which will list out all datastores and the vms that are within empty or not. get-datastore | select name, @{name="VM";e={get-datastore $_.name | get-v...
Add a comment...

Post has attachment
VMware: Powershell Query each ESX Hosts Syslog
This query will report each host and its current Syslog get-vmhost | select Name,@{Name="SysLog"; Expression={(get-vmhostsyslogserver $_.name)}} | FL
Add a comment...

Post has attachment
Powershell: Get services and accounts used to run them on all computers using Jobs
cls
####################
#By Tony Unger
#Purpose: inventory all local services and user accounts running them
#
##
$myCol = @()
$i =0
$servers = get-adcomputer -filter * | select -expand name

$scriptblock = {
param([string]$server)

get-wmiobject win32...
Add a comment...

Post has attachment
Powershell: RDP log of user account off of all servers using jobs.
#Log User account off all servers
# Tony Unger

$Domain = "Microsoft.com"
$Servers = Get-ADComputer -Filter {(OperatingSystem -Like "Windows Server*")-and (enabled -eq "true")} -Property SamAccountName -Server $Domain Select -expand Name
$username = "patung...
Add a comment...

Post has attachment
Powershell: VMware one liner to list total vm that are powered on each host
Get-VMHost | Select @{N="Cluster";E={Get-Cluster -VMHost $}}, Name, @{N="NumVM";E={($ | Get-VM).Count}},@{N="PoweredOn";E={($_ | get-vm | ? {$_.powerstate -like "*ON*"}).count}} | Sort Cluster, Name | fl
Add a comment...
Wait while more posts are being loaded