• Hi Emanuel!

    Invoke-Command is now my new best friend!

    In fact, I’ll also be using it for a code to extract the value of InterfaceIndex (thru Get-Netadapter). But how do I get the value/s of the property/ies (like InterfaceIndex and InterfaceAlias) of Get-Netadapter and use it/them, say move the value/s to a variable/s?

    Thank you!

  • Is there a way to get the value of InterfaceIndex and move it to a variable?

  • In this second post in my series about Hyper-V management with PowerShell I will explain how to create a Hyper-V virtual switch with PowerShell. In my previous post I explained how to install Hyper-V with PowerShell.

  • In this first post of my series about managing Hyper-V with PowerShell I will outline how to install Hyper-V Server and the Hyper-V role with PowerShell.

  • I got this error when run that script. Please help

  • I got this error when run that script. Please help

    Export-Csv : Cannot bind parameter ‘Delimiter’. Cannot convert value “NoTypeInformation” to type “System.Char”. Error: “String must be exactly one
    character long

  • Please help. I got below error when run script

    Export-Csv : Cannot bind parameter ‘Delimiter’. Cannot convert value “Encoding” to type “System.Char”. Error: “String must be exactly one character
    long.”
    At D:MyselfPSToolsCollectingSystemStability&ProblemOri.ps1:5 char:102
    + … ERPROFILEDocumentsReliabilityStabilityMetrics.csv ‑Encoding ASCII – …
    + ~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Export-Csv], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ExportCsvCommand

    Export-Csv : Cannot bind parameter ‘Delimiter’. Cannot convert value “Encoding” to type “System.Char”. Error: “String must be exactly one character
    long.”
    At D:MyselfPSToolsCollectingSystemStability&ProblemOri.ps1:6 char:84
    + … V $env:USERPROFILEDocumentsReliabilityRecords.csv ‑Encoding ASCII – …
    + ~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Export-Csv], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ExportCsvCommand

  • The -h switch of PsExec takes care of elevation problems. By the way, if nothing else works, you could use regular PowerShell remoting command like this:

    Invoke-Command -ComputerName remoteServer -FilePath D:ScriptsyourScript.ps1 -Credential domainadmin
  • But how can one use Psexec to execute a PowerShell script on a Windows server, and inject domain username/password (eg. Create-FailoverCluster that requires permissions to create AD computer object)?

    The user invoking the PowerShell script is NT AUTHORITYSYSTEM (from an Azure DevOps automated pipeline), but need the PS1 file to run with domain credentials. I can get the username and password to the script, but seems that it is not allowed to elevate the creds.

    Any advice?

  • Hi Emanuel!

    This is great! I’ll go ahead and try.

    Thank you so much!

  • In this case, PowerShell Direct is your friend. The VM needs to be on, but otherwise you can run the commands from the host. If the VMs are not in the same domain as the hosts, you can specify different credentials.

    https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/powershell-direct#run-a-script-or-command-with-invoke-command

  • Hi Emanuel!

    Thank you for replying! Well, my situation is that I need to run your commands ‘outside’ the VM. Sorry for the newbie term (‘coz I’m exactly that – a newbie). Specifically, the Set-DNSClientServerAddress command. This command necessitates me to be ‘inside’ the VM so I can change it’s DNS IP address. I need to do this while I’m ‘outside’ the VM. In fact, I’m adding this line of code to a Powershell syntax that automates VM creation installed with a virtual hard drive (to also automate OS installation) plus setting up virtual network connection with a specific DNS server. The part with the DNS server that I have to specify for the VM is the tricky part for me.

  • Hi, Lee, Roy, and Anthony. 🙂

    I’m glad you find this useful. You can run this command just as well inside VMs, there’s no actual difference. Or is it something specific to VMs that you had in mind?

  • Hi Emmanuel!

    Your codes are a godsend!

    Would it be possible for you to provide equivalent codes if we’re to apply these to virtual machines/VMs? Thank you!

  • The ImportExcel is a PowerShell module that allows you import to or export data directly from Excel spreadsheets without having Microsoft Excel installed on your computer. In this tutorial, you’ll learn to work with Import-Excel and Export-Excel. The ImportExcel module runs on Windows, Linux, or Mac and now can be used in Azure functions and GitHub Actions. Simply put, if you need to generate reports for work, you must learn this module.

  • Legend!

    I’ve set up Windows Event Forwarding (50 servers that send logs to 1 collector) and this just made my work a lot easier.

    Thanks and keep up the good work

  • Error 0x800f0954 usually occurs at the time of installing the .NET Framework or sub-components on Windows 10. Here’s how to resolve this issue in simple steps.

    In recent days, most Windows 10 users are reporting error 0x800f0954 while installing .NET Framework 3.5 or its subcomponents. Whatever may be the reason behind the error, the good thing is that you can fix the error by following some simple steps. Here are the best possible solutions to deal with this situation.

  • Thank you. I was thinking of how to rollback (remove) the extension, if something should go wrong or if management wants to remove it down the line. When we submit a “Change” we also need a rollback plan.

    This script works great for installing. Thank you very much for that.

  • Load More
© 4sysops 2006 - 2022

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account