PowerShell

PowerShell : Finding number of lines in a File

Posted on

Requirement: In Automation using PowerShell Scripting its very often a requirement to read input from a file.  Usually the input is separated by new line in the file. Your PowerShell should read all lines from the file and process the input line by line. Say, you have list of servers in file and you want to check service status for each of the server in the file.  Solution: In PowerShell Get-Content is used for most cases to read a file and process it line by line. It just works fine in most of the cases. But if you need to […]

Advertisements
Citrix

PowerShell script to detect if you are running in Citrix XenApp Environment

Posted on

PowerShell script to detect if you are running in Citrix XenApp Environment It is very usual that you find enterprises supporting Physical and Virtual environments. When you have to setup an automation or an application customization across such an enterprise, you often require to determine the environment where the user is logged in and apply appropriate settings. Say you want to set a user environment variable ONLY when an application is launched on the local physical machines but not when launched in Citrix environment.  If you have to achieve this with a script that runs automatically for all users, you […]