SOLVED

Commands dont display output when ran in a script

Copper Contributor

Hi Everyone 

 

I have put togeather a few commands to carry out a maciene survey.

 

Each line of code works fine when you run it individually, however when it runs in a script it dosnt output properaly. 

 

Any ideas 

5 Replies
What is the result of Get-ExecutionPolicy?

@Andres Gorzelany

get-executionpolicy returns 

RemoteSigned

 

Try to run your .ps1 with an unrestricted execution policy like this

PowerShell.exe -ExecutionPolicy UnRestricted -File .\script.ps1

and see if you got the intended output.

The same issue occurs

best response confirmed by Luke_Gilmore (Copper Contributor)
Solution
II was able to resolve this issue.

It works fine once i piped the output using format table instead of select object
1 best response

Accepted Solutions
best response confirmed by Luke_Gilmore (Copper Contributor)
Solution
II was able to resolve this issue.

It works fine once i piped the output using format table instead of select object

View solution in original post