# Incorrect time on servers, How to pass local time of Controller to Citrix server

**URL:** <https://forums.powershell.org/t/incorrect-time-on-servers-how-to-pass-local-time-of-controller-to-citrix-server/11806>\
**Category:** PowerShell Help\
**Created:** [December 18, 2018, 8:36am UTC](https://forums.powershell.org/t/incorrect-time-on-servers-how-to-pass-local-time-of-controller-to-citrix-server/11806 "2018-12-18T08:36:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![akadri724](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/akadri724/32/5863_2.png) [@akadri724](https://forums.powershell.org/u/akadri724)\
**Post date:** [December 18, 2018, 8:36am UTC](https://forums.powershell.org/t/incorrect-time-on-servers-how-to-pass-local-time-of-controller-to-citrix-server/11806/1 "2018-12-18T08:36:44Z")

</div>

I have a few hundred servers in my Citrix farm, The time is incorrect, I want to run a command and find the time difference between my Controller and the remote servers.

I am unable to pass the (get-date) value using invoke-command to Citrix servers.

Is there any other way to get the time difference, I am not interested in TIME ZONE, since the timezone is CST, but they have EST time on them

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [December 18, 2018, 9:00am UTC](https://forums.powershell.org/t/incorrect-time-on-servers-how-to-pass-local-time-of-controller-to-citrix-server/11806/2 "2018-12-18T09:00:45Z")

</div>

> I am unable to pass the (get-date) value using invoke-command to Citrix servers.

Use -ArgumentList or the using: keyword

> **[PowerShell: Passing variables to remote commands](https://powershellexplained.com/2016-08-28-PowerShell-variables-to-remote-commands/)**
>
> If you have started using Invoke-Command, then you have ran into the issue of getting local variables into your remote commands. There is a lot of advice out there on how to do this and some approaches are more clunky than others. First let me show...

---

<div class="post-metadata">

**Author:** ![akadri724](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/akadri724/32/5863_2.png) [@akadri724](https://forums.powershell.org/u/akadri724)\
**Post date:** [December 18, 2018, 9:25am UTC](https://forums.powershell.org/t/incorrect-time-on-servers-how-to-pass-local-time-of-controller-to-citrix-server/11806/3 "2018-12-18T09:25:21Z")

</div>

Rob,

Thanks for the answeer. I do know that we can use -ArgumentList for passing parameters to ICM

My question is " why does the below function give me local time rather than remove time when I use via icm"

function t-value{  
$ht=@{}  
$cname = $env:computername  
$tvalue = get-date -f ‘g’  
$ht[$cname] = $tvalue  
$ht  
}

---

<div class="post-metadata">

**Author:** ![fredrik-kacsmarck](https://avatars.discourse-cdn.com/v4/letter/f/a183cd/32.png) [@fredrik-kacsmarck](https://forums.powershell.org/u/fredrik-kacsmarck)\
**Post date:** [December 18, 2018, 9:43am UTC](https://forums.powershell.org/t/incorrect-time-on-servers-how-to-pass-local-time-of-controller-to-citrix-server/11806/4 "2018-12-18T09:43:16Z")

</div>

If the time is incorrect it sounds like either you’re not using NTP or the NTP source is misconfigured.  
If not using any NTP sync then the servers will drift over time as the onboard clocks are not that great.

```
w32tm.exe /stripchart /dataonly /computer:time.google.com /samples:1
```

Will give you the time difference against the NTP source [time.google.com](http://time.google.com).  
Just replace with whatever source you’re using in your organisation.

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [December 18, 2018, 10:04am UTC](https://forums.powershell.org/t/incorrect-time-on-servers-how-to-pass-local-time-of-controller-to-citrix-server/11806/5 "2018-12-18T10:04:29Z")

</div>

Try WMI to get the time. Get-Date should be displaying the local time on that server, but I’ve had Get-Date automatically convert UTC\GMT to local time on me before. Your not really explaining how the remote servers are configured. Are you seeing the time off by 20 minutes? Are you seeing that the date is in EST on the server but is converted to PST?

> **[Parsing remote machine local date and time with WMI](https://powershellmagazine.com/2012/04/20/parsing-remote-machine-local-date-and-time-with-wmi/)**
>
> The other day I was asked to check the local date and time on some workstations in our network. The reason for that was time skew, and as I was told, some workstations’ clock was 1 hour behind.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:33pm UTC](https://forums.powershell.org/t/incorrect-time-on-servers-how-to-pass-local-time-of-controller-to-citrix-server/11806/6 "2024-05-16T20:33:33Z")

</div>

Closed on May 16, 2024, 8:33pm UTC


