PowerShell command to list out all the VDAs registered or registered/unregistered to site and schedule it using task scheduler send the report over mail
The PowerShell command will be used to collect only unregistered VDAs from the site.
Get-BrokerDesktop -MaxRecordCount 5000 | Select-Object ClientName, AssociatedUserFullNames, MachineName, RegistrationState, StartTime, LastDeregistrationReason, CatalogName, LastConnectionTime, FunctionalLevel |Where-object {$_.RegistrationState -eq 'Unregistered'} | Export-Csv -Path C:\TEMP\Get-brokerDesktop.csv |Format-Table –AutoSize
Send-MailMessage –From administrator@ads.com –To VDA@ads.com –Subject “Guess what!” -Attachment "Get-brokerDesktop.csv" –Body “I am testing to get VDA status through PowerShell” -SmtpServer smtp.mail.com -Port 25
Below PowerShell command will be used to collect all VDAs registered/unregistered from the site.
Get-BrokerDesktop -MaxRecordCount 5000 | Select-Object ClientName, AssociatedUserFullNames, MachineName, RegistrationState, StartTime, LastDeregistrationReason, CatalogName, LastConnectionTime, FunctionalLevel, AssociatedUserSID, HostedMachineName | Export-Csv -Path C:\TEMP\Get-broker6.csv |Format-Table -InformationAction Stop -AutoSize
Send-MailMessage –From administrator@ads.com –To VDA@ads.com –Subject “Guess what!” -Attachment "Get-brokerDesktop.csv" –Body “I am testing to get VDA status through PowerShell” -SmtpServer smtp.mail.com -Port 25
No comments:
Post a Comment