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:
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.
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
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?
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.
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 StartPlease 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
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.
I ran this and have no issues with it on Windows 10.
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
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
:)
Just started my Jazz session... Your link is in time.
See this one... I play sax...
really cool album by Train... this is kind of PowerShell
Hey, we are on Microsoft forum.... :)
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.
Nicely said...
Thanks.