SysEngineer
SysEngineer

Reputation: 11

cannot find windows cmdlet

I am using Windows 7 as well as windows 2008 r2, I am trying to write a powershell script to find all the software installed on all the machines on my network. I have done research and see the cmdlets I need to do this task but I get some many unrecognized cmdlts. I am new to powershell and the other admins only use GUI's and I am trying to show them how powerful the command line can be. Is there something I need to run to update my machine with the latest cmdlets?

$PSVersionTable.PSVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      -1     -1       

currently the command that is failing is Get-RemoteProgram

I am using 64-bit machines

Upvotes: 1

Views: 2330

Answers (1)

Tony Hinkle
Tony Hinkle

Reputation: 4742

Assuming that you are using thisGet-RemoteProgram, you need to "dot source" it before you can use the command. This tells your script to read the file and include the functions it contains in your script.

. .\Get-RemoteProgram.ps1

Load the function into memory by dot-sourcing the script file this makes the Get-RemoteProgram function available in your current session of PowerShell

So your script would need to include

 . .\Get-RemoteProgram.ps1

prior to any call to Get-RemoteProgram

As far as the version of PowerShell, 3.0 is certinaly not the latest. You can always find the latest version at Microsoft. Currently, https://msdn.microsoft.com/powershell is a good place to reference, or even check Wikipedia--lots of places are kept updated with the latest info on PowerShell.

Upvotes: 1

Related Questions