the same command on same machine not running anymore
I successfully run PS script yesterday on 2012 server. Took a copy.
Today when run the same command on the same machine getting trouble. Tried different combinations. No luck...
Why it is not consistent? And plz suggestion...

Yesterday:

PS C:\nano-new> New-NanoServerImage -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -TargetPath .\Nano1 -ComputerName Nano1 GuestDrivers

cmdlet New-NanoServerImage at command pipeline position 1
Supply values for the following parameters:

Windows(R) Image to Virtual Hard Disk Converter for Windows(R) 10
Copyright (C) Microsoft Corporation.  All rights reserved.
Version 10.0.9000.0.amd64fre.fbl_core1_hyp_dev(mikekol).14  1224-3000 Beta


Today:

PS C:\NANO-New> New-NanoServerImage -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -TargetPath .\Nano1 -ComputerName
Nano1 GuestDrivers
New-NanoServerImage : The term 'New-NanoServerImage' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ New-NanoServerImage -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -TargetPat ...
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-NanoServerImage:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Suggestion [3,General]: The command New-NanoServerImage was not found, but does exist in the current location. Windows P
owerShell does not load commands from the current location by default. If you trust this command, instead type ".\New-Na
noServerImage". See "get-help about_Command_Precedence" for more details.
PS C:\NANO-New>
PS C:\NANO-New>

Tried Suggestion:

PS C:\NANO-New> ".\New-NanoServerImage" -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -TargetPath .\Nano1 -ComputerN
ame Nano1 GuestDrivers
At line:1 char:25
+ ".\New-NanoServerImage" -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -Targe ...
+                         ~~~~~~~~~~
Unexpected token '-MediaPath' in expression or statement.
At line:1 char:36
+ ".\New-NanoServerImage" -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -Targe ...
+                                    ~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'C:\NANO-New\ISOsource' in expression or statement.
    + CategoryInfo          : ParserError: ([], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

PS C:\NANO-New>
PS C:\NANO-New>

Folder structure:

 
August 31st, 2015 9:29pm

Hi,

Take a look into dot sourcing.

. .\New-NanoServerImage.ps1

That's <dot><space><dot><slash><filename> or <dot><space><path><filename> to be more precise. The first assumes that you're in the current directory and uses .\ as the path.

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 11:13pm

believe it or not...

today my 2 days ago no dots syntax worked. But :    .\    or   . .\   just returned the prompt.

What is the "miracle"? It is very hot outside today :). Would the same syntax run tomorrow?

Look :

PS C:\nano-new> .\New-NanoServerImage -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -TargetPath .\Nano1 -ComputerName Nano1 GuestDrivers

PS C:\nano-new>
PS C:\nano-new>
PS C:\nano-new>
PS C:\nano-new> . .\New-NanoServerImage -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -TargetPath .\Nano1 -ComputerName Nano1 GuestDrivers

PS C:\nano-new> New-NanoServerImage -MediaPath C:\NANO-New\ISOsource -BasePath .\Base -TargetPath .\Nano1 -ComputerName Nano1 GuestDrivers
cmdlet New-NanoServerImage at command pipeline position 1
Supply values for the following parameters:

Windows(R) Image to Virtual Hard Disk Converter for Windows(R) 10
Copyright (C) Microsoft Corporation.  All rights reserved.
Version 10.0.9000.0.amd64fre.fbl_core1_hyp_dev(mikekol).141224-3000 Beta

WARN   : Transcription is already running.  No Convert-WindowsImage-specific transcript will be created.

INFO   : Image 1 selected ()...
INFO   : Creating sparse disk...
INFO   : Attaching VHD...
INFO   : Disk initialized with MBR...
INFO   : Disk partitioned...
INFO   : Volume formatted...
INFO   : Access path (F:\) has been assigned...
INFO   : Applying image to VHD. This could take a while...
INFO   : Signing disk...
INFO   : Image applied. Making image bootable...
INFO   : Fixing the Device ID in the BCD store on VHD...
INFO   : Drive is bootable. Cleaning up...
INFO   : Closing VHD...

INFO   : Closing Windows image...
INFO   : Done.
Done. The log is at:
C:\Users\ADMINI~1\AppData\Local\Temp\2\New-NanoServerImage.log

PS C:\nano-new>

PS

September 1st, 2015 3:15pm

You must dot source before using the function.
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 3:20pm

this what I did following MS instruction...

The question is why it worked without .\     ....

Just restarted the server (it is Server 2012 R2 Standard) and run the command...

It becomes "crazy"...

It didn't run first time. Gave an error...

Then I tried .\   and . .\    Both came back with the prompt (without errors).

And last... run again without dot ...

And it works...

Bug?

September 1st, 2015 5:18pm

The problem is because you named the file the same as you named the function.  Change the file name and dot source it or load it like this:

Import-Module .\New-NanoServerImage.ps1

Once you sort out how this works you will not have these issues.

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 5:27pm

I used Microsoft's instruction... The only thing that I changed was an ISO content path.

I tried to be as close as possible to MS instruction.

Finally it is not end of the world but I want to be sure that I didn't do really stupid thing...

And even if I did... why it works one time YES one time NO.

The instruction (I used Example line and changed the ISO path only):

https://technet.microsoft.com/en-us/library/mt126167.aspx?f=255&MSPPError=-2147217396

Nano Server Quick Start
September 1st, 2015 5:57pm

Please read ALL of the Microsoft instructions:

Though the following manual steps are still valid, a script is available that automates conversion of the .wim image to VHD, as well as adding packages and settings. You can obtain it at PowerShell Script to build your Nano Server Image.  Note also that New-NanoServerImage.ps1 must be dot-sourced when you run it: .  .\New-NanoServerImage.ps1

Note that dot sourcing is required:

.<space>.\New-NonoServerImage.ps1

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 6:09pm

Here is an updated post referenced in the Microsoft's "Get Started" article. It has a newer version of the scripts and more complete instructions.

You must read the complete articles and follow all of the instructions carefully.  Also read the comments because they address many common issues.

http://blogs.technet.com/b/nanoserver/archive/2015/06/16/powershell-script-to-build-your-nano-server-image.aspx

I ran this and have no issues with it on  Windows 10.

September 1st, 2015 6:26pm

jrv,

just for the info...

the blog-post in your link is date June 15. The latest post June18.

My link is official MS that was updated Sep 18

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 6:51pm

jrv,

just for the info...

the blog-post in your link is date June 15. The latest post June18.

My link is official MS that was updated

September 1st, 2015 7:01pm

Thx.
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 7:11pm

Taa ta...Taa ta. https://www.youtube.com/watch?v=zqNTltOGh5c
September 1st, 2015 7:14pm

:)

Just started my Jazz session... Your link is in time.

See this one... I play sax...

https://www.youtube.com/watch?v=k3HKBpUrK

September 1st, 2015 7:49pm

Then you need this in the same vein....https://www.youtube.com/watch?v=clC6cgoh1sU
September 1st, 2015 7:52pm

really cool album by Train... this is kind of PowerShell

Hey, we are on Microsoft forum.... :)

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 8:03pm

If you can think like Trane you can PowerShell like an expert.

It requires an out-of-the-box state of mind or an out-of-the-mind state.

Good luck with the sax.

September 1st, 2015 8:05pm

Nicely said...

Thanks.

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 8:16pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics