Node IIS AppCmd wrapper for building tasks for Visual Studio Team Services. And capabillity to use PsExec to execute AppCmd remotely.
npm install --save vsts-iis
var iiServer = new iis.PsExec({
isRemote: true,
host: '\\\\ipOrHost',
username: 'serverUsername',
password: 'serverPassword'
});
var iiServer = new iis.PsExec();
iiServer.Sites.add({
name: 'Default Web Site',
protocol: 'http',
port: 80,
host: '*',
path : 'C:/inetpub/wwwroot'
}).then(function() {
console.log("Success");
});;
iiServer.Sites.remove('Default Web Site')
.then(function() {
console.log("Success");
});
iiServer.Sites.start('Default Web Site')
.then(function() {
console.log("Success");
});
iiServer.Sites.stop('Default Web Site')
.then(function() {
console.log("Success");
});
iiServer.Sites.exists('Default Web Site')
.then(function(exists) {
if (exists) {
console.log("Site exists!");
} else {
console.log("Site does not exist!");
}
});
iiServer.AppPools.add('DefaultAppPool')
.then(function() {
console.log("Success");
});
iiServer.AppPools.remove('DefaultAppPool')
.then(function() {
console.log("Success");
});
iiServer.AppPools.start('DefaultAppPool')
.then(function() {
console.log("Success");
});
iiServer.AppPools.stop('DefaultAppPool')
.then(function() {
console.log("Success");
});
iiServer.AppPools.recycle('DefaultAppPool')
.then(function() {
console.log("Success");
});
iiServer.AppPools.setIdentity('DefaultAppPool', 'ApplicationPoolIdentity')
.then(function() {
console.log("Success");
});
iiServer.AppPools.exists('DefaultAppPool')
.then(function(exists) {
if (exists) {
console.log("AppPool exists!");
} else {
console.log("AppPool does not exist!");
}
});
iiServer.Applications.add({
name: 'MyApplication',
virtualPath: '/',
physicalPath : 'C:/inetpub/wwwroot/MyApplication'
}).then(function() {
console.log("Success");
});;
iiServer.Applications.setAppPool('MyApplication', 'DefaultAppPool')
.then(function() {
console.log("Success");
});
iiServer.Applications.setWindowsAuthentication('MyApplication', true)
.then(function() {
console.log("Success");
});
iiServer.Applications.setAnonymousAuthentication('MyApplication', true)
.then(function() {
console.log("Success");
});
iiServer.Applications.exists('MyApplication')
.then(function(exists) {
if (exists) {
console.log("Application exists!");
} else {
console.log("Application does not exist!");
}
});