Script Packager

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Script Packager

Post by jvierra »

You likely don't have access to that server.

Run this at a command prompt:

Get-WmiObject win32_operatingsystem -ComputerName 'hardcodedservernamehere'
User avatar
markcusano
Posts: 21
Last visit: Mon Oct 23, 2017 1:22 pm

Re: Script Packager

Post by markcusano »

I can open the package ps1 file that is generated from the build and put it in Powershell ISE and when I run it, the gui comes up and runs great. The problem exists only if I try to run the exe.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Script Packager

Post by jvierra »

There is no reason for this. You are missing some information.

What was the results of using the one line I asked you to run?
User avatar
markcusano
Posts: 21
Last visit: Mon Oct 23, 2017 1:22 pm

Re: Script Packager

Post by markcusano »

I summarize:

The PSF you provided:
1 - The exe works great from my desktop and pulls my "desktop" reboot time.
2 - If I modify the PSF you provided to get a "Server" Reboot time and rebuild, it doesn't return the reboot time.

The PSF that I've built:
1 - The exe works great if I run to return my "desktop" reboot time.
2 - The exe doesn't return any results if I put in a "Server" name.
3 - I can take the package.PS1 code from the build and paste it in Powershell ISE, run it, and the gui comes up, and "bingo"... it pulls in the Server reboot time.

It's not failing with any errors, it's just not returning the "server" reboot time when I run the exe. It just returns the text saying, "here are the results"

My number 3 above is a key point that it's not that I can't reach the server.

Thanks for you effort in this. I know it's frustrating and certainly is for me as well. Seems so simple.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Script Packager

Post by jvierra »

You still have not done what I asked. Please run the command I posted in a PowerShell prompt - not an exe or an ISE. Just run that one command line.
User avatar
markcusano
Posts: 21
Last visit: Mon Oct 23, 2017 1:22 pm

Re: Script Packager

Post by markcusano »

SystemDirectory : C:\Windows\system32
Organization : CompanyName
BuildNumber : 7601
RegisteredUser : CompanyName
SerialNumber : nnnnn-nnn-nnnnnnn-nnnnn
Version : 6.1.7601
User avatar
markcusano
Posts: 21
Last visit: Mon Oct 23, 2017 1:22 pm

Re: Script Packager

Post by markcusano »

The previous one is from my desktop.



This one is from the server:

SystemDirectory : C:\Windows\system32
Organization : CompanyName
BuildNumber : 7601
RegisteredUser : CompanyName
SerialNumber : nnnnn-nnn-nnnnnnn-nnnnn
Version : 6.1.7601
User avatar
markcusano
Posts: 21
Last visit: Mon Oct 23, 2017 1:22 pm

Re: Script Packager

Post by markcusano »

I ran it from my desktop with the server name in it and from the server with the server name in it, just so there is no discrepancy.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Script Packager

Post by jvierra »

Did you run the command I posted or what. Please be clear about this.

Open a new PowerShel prompt and copy and paste this into the prompt.

Get-WmiObject win32_operatingsystem -ComputerName <replace with name>
User avatar
markcusano
Posts: 21
Last visit: Mon Oct 23, 2017 1:22 pm

Re: Script Packager

Post by markcusano »

Yes
I ran
Get-WmiObject win32_operatingsystem -ComputerName <replace with name>
from the Powershell Prompt (not ise)
and those are the results I received.

SystemDirectory : C:\Windows\system32
Organization : CompanyName
BuildNumber : 7601
RegisteredUser : CompanyName
SerialNumber : nnnnn-nnn-nnnnnnn-nnnnn
Version : 6.1.7601
This topic is 6 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked