Intermittent : The term 'get-date' is not recognized as the name of a cmdlet, function, script file, or operable program.
I have developed a batch harness whereby all scheduled tasks (W2012) invoke a common powershell script that acts as a wrapper to all our housekeeping jobs.
The first step in the wrapper is to create a Transcript file using following code
if ($Host.name -ne "Windows PowerShell ISE Host") # Transcript does not work within ISE
$timestamp = (get-date -format "yyyy-MM-dd-HH-mm-ss.fff")
$path = "c:\corp\$timestamp" + "_$pid.txt"
Start-Transcript -path $path -append
As expected the folder contains files with timestamp & pid in name
08/08/2013 11:00 AM 14,388 2013-08-08-11-00-01.158_1620.txt
08/08/2013 11:00 AM 12,506 2013-08-08-11-00-01.485_936.txt
08/08/2013 11:00 AM 12,994 2013-08-08-11-00-01.735_9328.txt
08/08/2013 11:00 AM 12,024 2013-08-08-11-00-01.766_8624.txt
08/08/2013 11:00 AM 13,902 2013-08-08-11-00-01.860_1756.txt
08/08/2013 11:01 AM 15,142 2013-08-08-11-01-31.392_10120.txt
08/08/2013 05:00 AM 14,982 _1692.txt
However note the last file, it has a zero length date time value in the name
The error recorded by PowerShell is
get-date : The term 'get-date' 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 C:\Corp\Powershell\DMPRun-ScheduledTask.ps1:171 char:18
+ $timestamp = (get-date -format "yyyy-MM-dd-HH-mm-ss.fff")
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (get-date:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
IE get-date has failed and returned a zero length field as the timestamp
Can anyone think of a good reason why get-date would fail intermittently?
Do I have to code defensively for base Powershell functions?
I implemented David's suggestion and now I intermittently get
import-module : Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
At D:\temp\loop_jc2_2013_11_25_08_55_02.ps1:15 char:1
+ import-module Microsoft.Powershell.Utility
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], UnauthorizedA
ccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Pow
erShell.Commands.ImportModuleCommand
I added a trap chain (My Powershell skills do not yet include recursive trap coding, any suggestions welcome)
trap {
trap {
"Trap1"
"Exception: " + $_
"Error: " + $Error[0]
"Message: " + $_.Exception.Message
"InnerException: " + $_.Exception.InnerException
"StackTrace: " + $_.Exception.StackTrace
"FailedItem: " + $_.Exception.ItemName
import-module Microsoft.Powershell.Management
import-module Microsoft.Powershell.Security
import-module Microsoft.Powershell.Utility
"Trap2"
"Exception: " + $_
"Error: " + $Error[0]
"Message: " + $_.Exception.Message
"InnerException: " + $_.Exception.InnerException
"StackTrace: " + $_.Exception.StackTrace
"FailedItem: " + $_.Exception.ItemName
import-module Microsoft.Powershell.Management
import-module Microsoft.Powershell.Security
import-module Microsoft.Powershell.Utility
import-module Microsoft.Powershell.Management
import-module Microsoft.Powershell.Security
import-module Microsoft.Powershell.Utility
trap {
"Trap3"
"Exception: " + $_
"Error: " + $Error[0]
"Message: " + $_.Exception.Message
"InnerException: " + $_.Exception.InnerException
"StackTrace: " + $_.Exception.StackTrace
"FailedItem: " + $_.Exception.ItemName
exit 1
get-date
Now I intermittently get ..
Trap2
Exception: Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
Error: Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
Message: Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
InnerException:
StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Threading.Mutex.MutexTryCodeHelper.MutexTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.Mutex.CreateMutexWithGuaranteedCleanup(Boolean initiallyOwned, String name, Boolean& createdNew, SECURITY_ATTRIBUTES secAttrs)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew)
at System.Management.Automation.AnalysisCache.CacheExportedCommands(PSModuleInfo module, Boolean force, ExecutionContext context)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingModulePath(PSModuleInfo parentModule, Boolean found, IEnumerable`1 modulePath, String name, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags,
PSModuleInfo& module)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
FailedItem:
import-module : Access to the path 'PowerShell_CommandAnalysis_Lock' is denied.
At D:\temp\loop_jc2_2013_11_25_09_19_52.ps1:26 char:1
+ import-module Microsoft.Powershell.Security
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], UnauthorizedA
ccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Pow
erShell.Commands.ImportModuleCommand
Similar Messages
-
I am trying to run the following Powershell in orchestrator to move a new user into a specific OU based on the Department field specified by the creator.
$dept = {Department from "Initialize Data"}
if ($dept -contains 'IT') {$NewContainer = OU=IT,DC=test,DC=net}
When I run the Powershell it is returning the following
The term 'IT' 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.
How can I get it to not try and pass 'IT' as a cmdlet?I think I may have actually found the solution I was missing { } around the command
I encapsulated the powershell in { }
$dept = {Department from "Initialize Data"}
if ($dept -contains 'IT') {$NewContainer = OU=IT,DC=test,DC=net} -
I have a script that runs well the vast majority of the time. On occasion I get an exception. I would appreciate any insight as to why it fails on occasion. I can't understand why the new-object cmdlet wouldn't be recognized:
Message: The term 'new-object' 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.
Source: System.Management.Automation
StackTrace: at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Here is the script I am running:
param([string]$endpoint)
$ErrorActionPreference = "Stop";
try
[System.Reflection.Assembly]::LoadFile("D:\dotNET_Apps\dotNETCOExBatch\DotNETCOExBatch\bin\DotNETCOExBatch.dll")
$schedule = new-object DotNETCOExBatch.CallService
$reply = $schedule.CallWebService($endpoint)
if ($reply)
$host.setshouldexit(0)
else
$host.setshouldexit(8)
Catch
$nl = [Environment]::NewLine
$evt=new-object System.Diagnostics.EventLog("Application")
$evt.Source="BatchPowerShell"
$infoevent=[System.Diagnostics.EventLogEntryType]::Error
$batchException = $_.Exception
$logMessage = " "
while ($batchException)
$exMessage = $batchException.Message
$exStackTrace = $batchException.StackTrace
$exSource = $batchException.Source
$logMessage += "$nl $nl Message: $exMessage $nl $nl Source: $exSource $nl $nl StackTrace: $exStackTrace"
$batchException = $batchException.InnerException
$evt.WriteEntry(" Error starting or process cancellation of $endpoint $logMessage",$infoevent)
$host.setshouldexit(15)Hi,
Please close your current powershell console, and start a new Window, and then check the result.
Like David replied, this is a strange issue, hard to find the cuase, but I will report the issue, hope
someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
Regards,
Yan Li
TechNet Subscriber Support
If you are
TechNet Subscription
user and have any feedback on our support quality, please send your feedback
here.
Cataleya Li
TechNet Community Support -
Hello,
I'm have create a simple runbook using Orch 2012 R2 and I'm experiencing the above error message. Below is the runbook Powershell
$clusterdr=Get-SCVMHostCluster-Name"cluster-dr.samuel.com"
Start-SCComplianceScan
-VMMHostCluster$clusterdr-RunAsynchronously
Thank you
LoyanHi,
the "Run .Net Script" Actitity from Orchestrator executes PowerShell in version 2.0 (and 32bit-mode).
Try:
PowerShell = {
$clusterdr=Get-SCVMHostCluster-Name"cluster-dr.samuel.com"
Start-SCComplianceScan -VMMHostCluster$clusterdr-RunAsynchronously }
or
http://www.sc-orchestrator.eu/index.php/scoblog/128-run-the-powershell-version-of-windows-executing-the-orchestrator-runbook-service-in-run-net-script-activity
Regards,
Stefan
www.sc-orchestrator.eu ,
Blog sc-orchestrator.eu -
The term 'Add-SPDistributedCacheServiceInstance' is not recognized as the name
Hi,
I have setup Sharepoint 2013 standalone on Windows 2012 server. I am developing an app that will make use of social apis of sharepoint 2013. Out of the box installation didnt have Distributed Cache Service running and I am not sure if its needed to be run
in order to make social apis working on the server. Anyhow, since distributed cache service was showing up as Stopped and I could not restart it, I have deleted the distributed cache service and when I retry to re-add it by entering Add-SPDistributedCacheServiceInstance
command on powershell, I get the following error,
Add-SPDistributedCacheServiceInstance : The term 'Add-SPDistributedCacheServiceInstance' 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
+ Add-SPDistributedCacheServiceInstance
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-SPDistributedCacheServiceInstance:String) [], CommandNotFoundExcept
ion
+ FullyQualifiedErrorId : CommandNotFoundException
I am at total loss here. Any help/pointers to get around this error and setup social api working on this server will be helpful.
Regards,
UsmanThe issue is because your PowerShell console has not loaded the appropriate SharePoint DLL
in order to call the API. To resolve this, you can open the SharePoint 2010 Management Shell to execute the script or add the assembly manually before running the script.
--Cheers -
The term "New-MailboxExportRequest" is not recognized.
Hi,
I'm trying to backup the mailboxes on my exchange server 2010 running on server 2008 R2 using the script from Steve Goodman (http://www.stevieg.org/2010/07/using-the-exchange-2010-sp1-mailbox-export-features-for-mass-exports-to-pst/)
I followed every step that is described in the tutorial. But if I run the script I get: The term "New-MailboxExportRequest" is not recognized as the name of a cmdlet, function, script file, or operable program.
The permissions for the folder are: exchange trusted subsystem, administrators Full control. I ran the command
"New-ManagementRoleAssignment -Role "Mailbox Import Export" -User Administrator" in the powershell of exchange. I tried exporting a single mailbox to PST but I got the same error. Nothing seems to work.
Does anyone know a solution? Help would be appreciated.
CheersHi Sturme,
I suggest you follow this document use New-MailboxExportRequest to export the mailbox, then check whether this issue will occur or not.
New-MailboxExportRequest
http://technet.microsoft.com/en-us/library/ff607299.aspx
If you want to use the script from Steve Goodman, please paste the exact error you get (when you run it in Exchange Management Shell ).
Thanks,
Evan
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
I have restored successfully an exchange 2013 mailbox database from backup to the recovery database, but when i try to recover a user's mailbox I receive the following error
New-MaiboxRestoreRequest -SourceDatabase RDB1 -SourceStoreMailbox "testuser" -TargetMailbox [email protected]
The term 'New-MaiboxRestoreRequest' 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.
I already have the "mailbox import export" management role assigned to the logged in administrator.
Anand_Nsilly me i spelt the command wrong
Anand_N -
Powershell error: 'Get-AzureRole' is not recognized as the name of a cmdlet
I am trying to
get PIP information on all instances of a role using Windows PowerShell
as per the document - "https://msdn.microsoft.com/library/azure/dn690118.aspx"
When I execute the command in the doc in the powershell:
Get-AzureRole -ServiceName FTPInAzure -Slot Production -InstanceDetails
The following error msg pops up:
'Get-AzureRole' is not recognized as the name of a cmdlet.
what's wrong?
Thanks
Thank you MorrisHi,
Thanks for posting !
I am currently researching to gather more information which might take some time and hence will get back to you shortly.
Appreciate your time and patience.
Regards,
Sowmya -
The Reader Wi-Fi is not recognized by the computer or Reader software.
Solved!
Go to Solution.When this situation occurs, the Reader™ Digital Book will not appear in the software or the software may shut down when connecting the Reader Digital Book to the computer. Follow these steps to resolve this problem:
NOTE: Because each of these steps represents a possible solution to this problem, open the Reader software and connect the Reader Digital Book to the computer after completing each step.
Make sure you that you are using the Reader for PC or Reader for Mac software.
NOTE: These models are not compatible with the Reader Library software.
When you connect your Reader Digital Book to the computer, depending on your model, do the following:
PRS-T1: In the USB connected screen, make sure you tap the Data Transfer Mode icon so that your Reader goes into Data Transfer Mode.
PRS-T2: In the Do you want the computer to recognize this device screen, make sure you tap Yes so that your Reader is recognized correctly.
If the problem persists, close the software, re-open it, and then check the connection status again.
Verify that the Reader Digital Book battery has an adequate charge.
NOTE: If the battery is discharged, allow the battery to charge for at least one hour before attempting to connect the Reader Digital Book to the software.
Verify that the Reader Digital Book is turned on and is not locked.
Verify that the USB cable is properly and securely connected to the Reader Digital Book and the computer.
NOTE: The USB cable should be connected directly to the computer. Connecting the Reader Digital Book using a USB hub or extension cable is not supported.
Verify that the Reader Digital Book displays the USB connection indicator in the upper-right corner of the screen.
Remove any Memory Stick® media or SD media in the Reader Digital Book.
Disconnect any other USB Device except for your Keyboard, Mouse or Wireless USB transmitter.
With the Reader Digital Book connected to the computer, uninstall the USB driver.
After you uninstall the driver, disconnect and then reconnect the Reader Digital Book back to the computer, allow a few moments for the driver to reinstall and then check the status.
If the problem still happens, turn off your Reader digital book and do a Hard Reset.
IMPORTANT: After doing a Hard Reset, it will be necessary to authorize your unit again.
If possible, install the Reader software on a different computer and connect the Reader Digital Book to test.
The troubleshooting steps listed above should resolve your issue. If you have completed all of the steps and the issue is not resolved, service may be required. -
In CloverETL the Text Enrichment component not recognizing Indian Person Names
Im using OEID Integrator ETL3.1.1.
The component Text Enrichment is not recognizing Indian Person Names. Is there any lib files which needed to be added in Lexalytics?
Please suggest.Holy S H ! T, I thought this was only me!
SEVEN Months, and Apple has NOT addressed your issue.
I was gonna say "I miss Steve", then I remembered he didn't answer user concerns either... -
I cannot email a photo using iPhoto "share. I keep getting "username/password not recognized". I used to use this function all the time but all of a sudden, I keep getting this message.
In iPhoto, open Preferences (under iPhoto in the menu bar) and click the "Accounts" tab on top. Make sure your email account(s) is/are set up there correctly, just as they are in Apple's Mail. Make sure the password in included.
-
Date is not inserted in the DB table
Hi,
I have a view, showing some data, including date and I have a save button. View has some of the fields update able. When I click the save button a bean function is called which run the query to update values in the DB table, taking those values from the view.
Now the problem is, date is not updated as the query doesn't run just because of the date and I am getting this error:
ORA-01861: literal does not match format string
and the date format is: 2013-09-23
I have tried using to_date() method, but it didn't work for me.
Here is my query:
oracle.jbo.domain.Date Pshipdate =( oracle.jbo.domain.Date) rowSelected.getAttribute("Pshipdate");
"UPDATE SHIPEXT" +
" SET APP = " +
"'" + status + "' " +
", PSHDAT = " + "to_date('" + Pshipdate + "', 'dd/mm/yyyy')"
+ ", MBY = " +
"'" + LoggedInUser + "'"
+ ", IP = " +
"'" + IP + "'"
+ ", DSREMS = " +
"'" + descrems + "'" +
", MDAT = "
+ "to_date('" + getCurrentTimeStamp() + "', 'dd/mm/yyyy')" +
" Where WO =" +
"' " + workorder + "'"
+ "AND SR = " +
"'" + sr + "'"I'll repost what you branched off
There's all kinds of things wrong.
For a start, I can't see P_shipdate anywhere, though I can see Pshipdate.
If you mean Pshipdate, Java is converting it to a string which you are then converting back to a date with to_date.
Check that the default print string returned is of dd/mm/yyyy format.
Similarly with MDAT and getCurrentTimestamp - what is default print string of geCurrentTimestamp?
All these problem could be avoided if you use bind variables.
We are trying to help but you seem determined not to accept any help.
Have you checked the print string formats of Pshipdate and getCurrentTimestamp? -
I have tried all I can to load iTunes cards into my iPad without success. Upon giving one of the cards to a friend he conveniently loaded. I keep getting the error message: "The code you entered is not recognized as a valid code". I just don't know what to do as I need to use these cards to make purchases off the I tunes store.
i tried with out using commmit but it is not creating Status.
When i see the function module help and they are trying to COMMIT
FU STATUS_OBJECT_CREATE
Short Text
Create Status Object
Functionality
The function module generates a status object.
Take the object number from the object number management (function modules OBJECT_NUMNBER_GET_xx).
If no object number is given, the module takes a temporary object number that must be replaced later (function module STATUS_OBJECT_SWITCH_NUMBER).
Example
Creating an internal order with number 100123 (object type "ORC") for status profile "STATSCHEM" with final object number
call function 'OBJECT_NUMBER_GET_OR'
exporting
aufnr = '100123'
importing objnr = objektnummer.
call function 'STATUS_OBJECT_CREATE'
exporting
objnr = objektnummer
obtyp = 'ORC'
stsma = 'STATSCHEM'.
commit work.
Creating the same order with a temporary object number
data: objectkey like ionra.
* TBO00-REFSTRUCT for object type 'OR' is 'IONRA'
objectkey-aufnr = '100123'.
call function 'STATUS_OBJECT_CREATE'
exporting
i_objectkey = objectkey
obtyp = 'ORC'
stsma = 'STATSCHEM'.
importing
objnr = objektnummer.
call function 'OBJECT_NUMBER_GET_OR'
exporting
aufnr = '100123'
importing objnr = objektnummer_neu.
call function 'STATUS_OBJECT_SWITCH_NUMBER'
exporting
objnr_old = objektnummer
objnr_new = objektnummer_neu.
commit work.
Notes -
My ipad is not being seen by itunes in Windows 7. I uninstalled then reinstalled itunes it started working for a while then it stopped. I get a message stating that the device is not recognized or the device is defective replace device. Anyone have a fix.
At present I have no power to the Gen 7, so need to get some power to it I think. I pressed the buttons as you suggested, but nothing is showing up at this point. Thank you for your response as the more I can rule out before I take it back the better I think.
-
I need help! when I am importing my NEF Raw files from my D3300 camera into lightroom 5 and try to use the "copy as DNG" button I always get an error message saying that "saying the file is not recognized by the raw format support". The whole purpose of that button is so that the file can be recognized... How can I make the "copy as DNG" button work as it is supposed too?? Thank you
Thank you for responding. So I essentially will never be able to use that button in lightroom 5? do I need to get LR 6? Will there ever be an update for LR 5 that will enable me to use it?
Does DNG Converter work within LR or do I have to upload pictures to my computer and then make a second copy in DNG format. and then go into LR and use them?
Thank you @dj_paige
Maybe you are looking for
-
I'm creating a new website for sharing news and photos for my family. I want to use the iWeb blog for my entries and plan to do some customization of my site through HTML snippits, iFrames, etc. I've been reading quite a bit on this forum and other u
-
Header and Footer in SiteStudio designer
Hi, Is there any option for header and footer in SIte Studio Designer? Regards, Harini.
-
New Macbook Pro, no mini-DVI port? (HDTV connect question)
Most online resources suggest that Mac users can connect their computers to their HDTV's through the mini-DVI port, but I examined my Macbook and saw that the new version (purchased 2 months ago, roughly) doesn't have this port. This being the case,
-
Wildcards in Classpath for JNI-Calls
Is it possible to use wildcards in the classpath for KNI-Calls? I would like to use wildcard for jni-calls like for normal java-calls (java -classpath *.jar ...), but it is not working. JDK version is JDK 1.5.0 on Win32
-
Hi, I'm trying to use Blueprints for Data Services. I used document "Blue Prints Data Services Content Objects.pdf", there are all Instructions for downloading and installing. So I have done these steps: (1) Install the Global Parsing Options (2) Dow