• Swapnil, that worked. Thanks.

  • Swapnil — I’ll try that.

     

    Michael — I don’t want the files to be deleted from the CD

  • Need help using Get-Childitem and I need it to create a new folder and then copy the contents of the D drive to that folder. For some reason it will only create the folder without copying over the contents of D:

     

    This is what is looks like now.

    New-Item -ItemType directory -Path "$PHRFolder$clinic$PatientName"
    Get-ChildItem -Path D: -Recurse -Filter *.pdf, *.txt | Copy-Item -Destination "$PHRFolder$clinic$PatientNametest_"
  • Luc,

     

    I added the ]

    Now I’m getting this error

    + ~
    Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
    At I:HTToolboxHT-CDScript.ps1:9 char:44
    + [ValidateSet(Mandatory= $true)][string]("Alamo Heights","Blanco", ...
    + ~
    Missing ')' in function parameter list.
  • Hey Luc,

    Here’s the error.

    At line:2 char:29
    + [Parameter(Mandatory= $true)[string]$PatientName,
    + ~
    Missing ] at end of attribute or type literal.
    At line:3 char:494
    + ... SW Military","Val Verde","Walnut Square","Westover Hills","Wurzbach")
    + ~
    Missing ] at end of attribute or type literal.
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : EndSquareBracketExpectedAtEndOfAttribute

     

    This param block is part of the same script I used the Send-MailMessage cmdlet in. That’s why I didn’t create a new topic, feel free to move it though.

  • Can someone tell me what’s wrong with this?

    param(
    [Parameter(Mandatory= $true)[string]$PatientName,
    [ValidateSet(Mandatory)]("_TEST","Alamo Heights","Blanco","Highlands","Hill Country","Holy Cross","Ingram Park","Las Palmas","Leon Valley","Lexington","Metro","Perrin Beitel","San Pedro","Stone Oak","SW Military","Val Verde","Walnut Square","Westover Hills","Wurzbach","Alamo Heights","Blanco","Highlands","Hill Country","Holy Cross","Ingram Park","Las Palmas","Leon Valley","Lexington","Metro","Perrin Beitel","San Pedro","Stone Oak","SW Military","Val Verde","Walnut Square","Westover Hills","Wurzbach")
    [string]$Clinic 
    
    )
    $PHRFolder = "htmg-file01publicPatient Health Record CD"
    
    
    New-Item -ItemType directory -Path "$PHRFolder$clinic$PatientName"
    Get-ChildItem -Path D: -Recurse -Filter *.txt | Copy-Item -Destination "$PHRFolder$clinic$PatientNametest_"

    PS returns this error

  • Got it to work doing this

    
    New-Item -ItemType directory -Path "$PHRFolder$clinic$PatientName"
    Get-ChildItem -Path D: -Recurse -Filter *.txt | Copy-Item -Destination "$PHRFolder$clinic$PatientName"
  • Team, I need some help fine tuning it.

    I added these lines to the script to get it to copy files from the D drive to a network share. How would I modify it so that it only copies files that are .PDF or contain the word “DICOM”?

    Start-Process "C:Program FilesRadiAntViewer64bitRadiAntViewer.exe" -d "D:" -tg "P:Patient Health Record CD"
    Copy-Item -Path "D:" -include "*.pdf" -Destination "P:Patient Health Record CD"

    I tried this to no avail. It didn’t return any errors but it also doesn’t copy any files over.

    Thanks

  • This worked for me. Thank you all for your help!

     

    Send-MailMessage -To ((($to -split " ") -join ".")+"@healthtexas.org") -From (Get-ADUser $env:username -Properties emailaddress).emailaddress -Subject 'Patient CD' -Body $body -SmtpServer '10.98.0.20' -Credential ' '
  • We had an incident at my company where one of our systems monitor’s started randomly flickering. We went down the list of fixes and eventually just ended up doing a system refresh. Any easy fix for this would have been to roll back to a restore point but unfortunately Windows 10 comes with System Protection turned off. How can I get PowerShell to generate a list of machines in my domain who have System Protection turned off and then use Invoke-Command to remotely enable it?

  • Could this be an internal authentication issue?

  • Revisiting this script. Luc, a little miscommunication there. That error actually comes back even when I don’t use -Credential.

     

     

     

  • I’m getting this error message when I try to recreate the machines by running Add-LabMachineDefinition -Name DCSRV -OperatingSystem ‘Windows Server 2019 Standard Evaluation
    (Desktop Experience)’ -Roles RootDC -DomainName ‘homelab.local’

    Write-Error : A machine with the name 'DCSRV' does already exist
    At C:Program FilesWindowsPowerShellModulesAutomatedLabDefinition5.9.0AutomatedLabDefinition.psm1:2055 char:13
    +             Write-Error $errorMessage
    +             ~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

    Write-LogFunctionExitWithError : Add-LabMachineDefinition…leaving: A machine with the name 'DCSRV' does already exist
    At C:Program FilesWindowsPowerShellModulesAutomatedLabDefinition5.9.0AutomatedLabDefinition.psm1:2056 char:13
    +             Write-LogFunctionExitWithError -Message $errorMessage
    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-LogFunctionExitWithError

  • How do i get the lab to actually be permanent? Seems like it deletes itself after a day yet when I go to try and recreate it, it doesn't let me use the same server names. Tells me the server name is already assigned.

  • Yea, I still want to some add devices to the domain for experimentation purposes (I'm taking my MCSA soon). Does the DC need to have a static IP?

  • Paolo,

    I decided to run with TeamViewer instead of AnyDesk because AnyDesk doesn’t allow you to use Hyper-V on the remote PC,  at least the free version doesn’t.

  • Anthony,

    This is a very convenient tool for automating the process of building a Hyper-V lab. I followed the steps and was succesful in creating the VMs and connecting to them. I'm running into an issue joining my host machine to the domain though, I receive the following error:

    The following error occurred when DNS was queried for the service location (SRV) resource record used to locate an Active Directory Domain Controller (AD DC) for domain "homelab.local":

    The error was: "DNS name does not exist."
    (error code 0x0000232B RCODE_NAME_ERROR)

     

    One thing to note: I don't have access to the router that the host machine is connected to, as I use the WiFi provided by my apartment complex.

     

  • Load More
© 4sysops 2006 - 2023

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