5 Replies Latest reply on May 16, 2014 9:23 AM by sbrumley

    Powershell Invoke-Swisverb trouble

    sbrumley

      Please help.  I"m having trouble trying to unmanage a list of devices.  Below is my script.

       

      When it gets to invoke-swisverb it errors out with this message:

       

      Could not find file 'C:\Users\userid\AppData\Local\Temp\zfye57a-.dll'.

      At H:\unmange.ps1:22 char:22

      +       Invoke-SwisVerb <<<<  $swis Orion.Nodes Unmanage @("$nodeID",$now,$($myLine[1]),$false)

          + CategoryInfo          : NotSpecified: (:) [], FileNotFoundException

          + FullyQualifiedErrorId : System.IO.FileNotFoundException

       

       

      SCRIPT

      $swis = Connect-Swis #--Credential $creds

       

      $a = Get-Content h:\opt\hd\hostsunmanage.txt

       

      foreach ($line in $a)

         {

         if ($line -ne "")

            {

            $now=[DateTime]::UtcNow

            $line = $line.Trim()

            $myLine = $line.split(",")

            $retStuff = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE DNS = '$($myLine[0]).Trim()'"

       

            $nodeID = "N:$retStuff"

       

            Write-Host $($myLine[0]) " will be unmanaged from $now util " $($myLine[1])

           

            Invoke-SwisVerb $swis Orion.Nodes Unmanage @("$nodeID",$now,$($myLine[1]),$false)

           }

         }

        • Re: Powershell Invoke-Swisverb trouble
          tdanner

          Let's get more info about that error. Run the script at the command line to reproduce the error, then run this command:

           

          $error[0]|format-list -force

           

          That will get a stack trace and some other details to help us understand what is going on here.

            • Re: Powershell Invoke-Swisverb trouble
              sbrumley
              Exception         : System.IO.FileNotFoundException: Could not find file 'C:\Users\userid\AppData\Local\Temp\nr900abq.dll'.
                                  File name: 'C:\Users\userid\AppData\Local\Temp\nr900abq.dll'
                                     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
                                     at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Bo
                                  olean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES se
                                  cAttrs, String msgPath, Boolean bFromProxy)
                                     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share
                                  , Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
                                     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share
                                  )
                                     at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] f
                                  ileNames)
                                     at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[]
                                   sources)
                                     at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssembl
                                  yFromSourceBatch(CompilerParameters options, String[] sources)
                                     at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters opti
                                  ons, String[] sources)
                                     at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompil
                                  erParameters xmlParameters, Evidence evidence)
                                     at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] t
                                  ypes, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, A
                                  ssembly assembly, Hashtable assemblies)
                                     at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, Strin
                                  g defaultNamespace, String location, Evidence evidence)
                                     at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type t
                                  ype, String defaultNamespace)
                                     at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
                                     at SwisPowerShell.InvokeSwisVerb..ctor()
              TargetObject      :
              CategoryInfo      : NotSpecified: (:) [], FileNotFoundException

              FullyQualifiedErrorId : System.IO.FileNotFoundException

              ErrorDetails      :
              InvocationInfo    : System.Management.Automation.InvocationInfo

              PipelineIterationInfo : {}

              PSMessageDetails  :