Powershell XML替换并保存不更新

时间:2016-07-11 03:16:17

标签: xml powershell

我正在尝试使用powershell更新配置文件。但是脚本没有更新配置文件。非常感谢有关如何正确执行此操作的任何帮助。谢谢!

 exports.handler = function(event, context) {
    // 
    if(event.userPoolId === "us-east-t9....") {

        // Identify why was this function invoked
        if(event.triggerSource === "RegisterUser") {
            // This Lambda function was invoked because a new user signed up to the user-pool "theRequiredUserPool"
            // Ensure that your message contains event.request.codeParameter, this is the place holder for code that will be sent.
                        var link = "https://.....confirm_user.html?username="+ event.userName + "&code=" + event.request.codeParameter;
            var message = "Thank you for signing up. Your confirmation code is " + event.request.codeParameter;
            message+= " Click <a href='"+link+"'>here to finish your registatration!";
            event.response.emailSubject = "Welcome to the service";
            event.response.emailMessage = message;

        }
        // Create custom message for other events
    }
    // Customize messages for other user pools


    // Return result to Cognito
    context.done(null, event);
}

1 个答案:

答案 0 :(得分:0)

你可以这样做:

$rptmonth = Get-Content 'C:\Users\reportingmonth.txt' -First 1
[xml]$xml = Get-Content $actconfigpath
$xml.runmonth = [string] $rptmonth
$xml.Save($actconfigpath)