Skip to content

Instantly share code, notes, and snippets.

@andrewchumchal
Last active August 17, 2020 18:22
Show Gist options
  • Save andrewchumchal/afce64e1e43d8bde87a3133bc7280f7c to your computer and use it in GitHub Desktop.
Save andrewchumchal/afce64e1e43d8bde87a3133bc7280f7c to your computer and use it in GitHub Desktop.
Computer ServiceNow Check
if (fsFunction == 'Computer' || fsFunction == 'Server'){
if (computerServerClass == "Linux" && classIpAddress == vcenterServerIp) {
className = 'cmdb_ci_vcenter';
gs.debug("Forscout - This is an vCenter System [ " + className + "], [ " + computerServerClass + "]." );
}else if (computerServerClass == "Linux" || computerServerClass == "CentOS" || computerServerClass == "Ubuntu"){
className = 'cmdb_ci_linux_server';
gs.debug("Forscout - This is an Linux System [ " + className + "], [ " + computerServerClass + "]." );
} else if (computerServerClass == 'Windows' || computerServerClass == 'Windows 7 Professional SP1' || computerServerClass == 'Windows Server 2008 R2' || computerServerClass =='Windows Server 2012' || computerServerClass =='Windows Server 2012 Standard' ){
className = 'cmdb_ci_win_server';
gs.debug("Forscout - This is an Windows System [ " + className + "], [ " + computerServerClass + "]." );
}
return className;
}
@aaronrsiphone
Copy link

aaronrsiphone commented Aug 17, 2020

`if (fsFunction == 'Computer' || fsFunction == 'Server'){
var className = "Unknown";
const linuxNames = ["Linux", "CentOS", "Ubuntu"];
const windowsNames = ["Windows", "Windows 7 Professional SP1", "Windows Server 2008 R2", "Windows Server 2012", "Windows Server 2012 Standard"];

if (computerServerClass == "Linux" && classIpAddress == vcenterServerIp) {
    className = 'cmdb_ci_vcenter'; 
    gs.debug("Forscout - This is an vCenter System [ " + className + "], [ " + computerServerClass + "]." );
}else if (linuxNames.includes(computerServerClass)) { 
    className = 'cmdb_ci_linux_server';
    gs.debug("Forscout - This is an Linux System [ " + className + "], [ " + computerServerClass + "]." );
} else if (windowsNames.includes(computerServerClass)) {
    className = 'cmdb_ci_win_server';
    gs.debug("Forscout - This is an Windows System [ " + className + "], [ " + computerServerClass + "]." );
}
return className;

}`

@aaronrsiphone
Copy link

I don't know why the formatting is weird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment