your home for end-user virtualization!

Microsoft

Find the installed Citrix Receiver version using Windows Powershell

$workstations = Get-Content .\pclist.txt $datestamp = Get-Date -Format “yyyyMMdd” foreach ($workstation in $workstations) { $cdviewer = “\\$workstation\C$\Program Files\Citrix\ICA Client\CDViewer.exe” if (Test-Path $cdviewer) { $citrixver = (Get-Command $cdviewer).FileVersionInfo.FileVersion } else { $citrixver = “Not Installed” } “$workstation | $citrixver” | Out-File -Append .\citrix_results-$datestamp.txt }

Posted in Citrix, Citrix XenDesktop, Microsoft, Powershell, VDI - Virtual Desktop | 1 Comment »

Changing the DNS server value on a list of computers using Windows Powershell

First, populate c:\comp.txt (or any other text file) with a list of target devices (one per line). Then modify the $newDNS variable so that its correct to your environment. $servers = get-content C:\comp.txt foreach($server in $servers) { Write-Host “Connect to $server…” $nics = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $server -ErrorAction Inquire | Where{$_.IPEnabled -eq “TRUE”} $newDNS = […]

Posted in Microsoft, Powershell | No Comments »

How to send an email attachement within a script using Windows Powershell

$filename = “c:\results.csv” $smtpServer = “smtpserver.domain.local” $msg = new-object Net.Mail.MailMessage $att = new-object Net.Mail.Attachment($filename) $smtp = new-object Net.Mail.SmtpClient($smtpServer) $msg.From = “fromaddress@domain.local” $msg.To.Add(”toaddress@domain.local”) $msg.Subject = “Nightly Log File” $msg.Body = “The nightly log file is attached” $msg.Attachments.Add($att) $smtp.Send($msg) Then call the script using ./email.ps1

Posted in Microsoft, Powershell | No Comments »

Searching the Windows event log for particular events using Powershell

Ran into a situation where I wanted to search the event log for the last 5 events. To quickly do so, I used Windows Powershell. $pcs = get-content c:\pvs.txt $date = (get-date).AddDays(-1) $datetoday = get-date foreach ($pc in $pcs) { $pverrors = get-eventlog -computer $pc -log Application -source StreamProcess -entrytype Error -after $date -before $datetoday […]

Posted in Microsoft, Powershell | No Comments »

Search

Categories