Configuring Windows System to Allow/Accepts Powershell commands from Remote Systems

When you try to execute a PowerShell command on a remote computer and you receive below error message stating that connection to remote computer failed. PS C:> Invoke-Command -ComputerName "TestSrv" -ScriptBlock {$env:computername} [TestSrv] Connecting to remote server failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination […]

Read more

List stopped Citrix services via Powershell

PS C:> Get-Service | Where-Object {$_.displayname -match "citrix" -and $_.status -eq "stopped"} | Sort-Object status Status   Name               DisplayName ——   —-               ———– Stopped  CTXCPUBal          Citrix CPU Utilization Mgmt/CPU Reb… Stopped  CtxAudioSvc        Citrix Audio Redirection Service Stopped  cpsvc              Citrix Print Manager Service Stopped  PCMAgent           Citrix XenApp Power and Capacity Ma… Stopped  CtxSmartCardSvc    Citrix Smart Card Service Stopped  ctxcpuSched        Citrix CPU Utilization Mgmt/Resourc… Stopped  Citrix EUEM        Citrix End User Experiencing Monito… Stopped  Citrix Encrypti… Citrix Encryption Service Stopped  Citrix 64-bit V… Citrix 64-bit Virtual Memory Optimi… Stopped  CitrixWMIService   Citrix WMI Service Stopped  CitrixHealthMon    Citrix Health Monitoring and Recovery Stopped  Citrix Virtual … Citrix […]

Read more

PowerShell working with Comma Separate File Data

Test File   Read the complete CSV file contents into a string: Code: $CSV2String  = Get-Content -path "C:TempTest-File.csv" write-host "[$CSV2String]"   Output: [User001, DFdP, FmpD User002, weKC, v85F User003, va2W, gwkE User004, fBBn, dhey User005, cUmC, 9vpK User006, xESN, FDTc User007, FL4p, EpgS User008, 9EV9, GBTc User009, NtPA, NGDN User010, FKcY, 1NCL]     Read the CSV file line by line.  Print each of the CSV file line in its CSV format Code: $CSV2String  = Get-Content -path "C:TempTest-File.csv" foreach ($line in $CSV2String) {     write-host "[$line]" }   Output: [User001, DFdP, FmpD] [User002, weKC, v85F] [User003, va2W, gwkE] …   […]

Read more